The watcher part isn't needed. All you have to do is write the tests themeselves.
import org.junit.*; import org.junit.rules.*; import org.junit.runner.Description; public class JavaTest{ Java java = new Java(); @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception {} @Test public final void testMultiply() { Assert.assertEquals("The two values should multiply together", 50, java.multiply(10, 5)); } }
- import org.junit.*;
- import org.junit.rules.*;
- import org.junit.runner.Description;
- public class JavaTest{
- Java java = new Java();
- @Before
- public void setUp() throws Exception {}
- @After
- public void tearDown() throws Exception {}
@Rulepublic TestWatcher testWatcher = new TestWatcher(){@Overrideprotected final void succeeded(Description description) {super.succeeded(description);}@Overrideprotected final void failed(Throwable e, Description description) {super.failed(e, description);}};- @Test
- public final void testMultiply() {
- Assert.assertEquals("The two values should multiply together", 50, java.multiply(10, 5));
- }
- }
int main()
{
printf("%d\n", test());
}
int test()
{
__asm__("movl $1337, %eax");
}
I wonder what this does?
(defn goes-before? [val1 val2] (<= val1 val2))
;; bubble: list of number -> list of number
;; This was originally racket code,
;; so it used 'car' and 'cdr' instead of 'first' and 'next'
;; Why can't clojure keep my theming?
(defn bubble [tanks]
;; I'm using nested if statements here because I want to use let
(if (or (nil? tanks) (nil? (next tanks)))
(cons tanks '(false))
(let* [truck (first tanks) convoy (next tanks) jeep (first convoy)]
(if (goes-before? truck jeep)
(let [debrief (bubble convoy)] (cons (cons truck (first debrief)) (next debrief)))
(cons (cons jeep (first (bubble (cons truck (next convoy))))) '(true))
)
)
)
)
;; bubble-sort: list of number -> list of number
(defn bubble-sort [l]
(let [bubbly (bubble l)]
(if (first (next bubbly))
(bubble-sort (first bubbly))
(first bubbly)
)))
(prn (bubble-sort (list 5 4 3 2 1)))