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)); } }
… Expand 1 1 import org.junit.*;
2 2 import org.junit.rules.*;
3 3 import org.junit.runner.Description;
4 4 5 5 public class JavaTest{
6 6 Java java = new Java();
7 7 8 8 @Before
9 9 public void setUp() throws Exception {}
10 10 @After
11 11 public void tearDown() throws Exception {}
12 12 13 − @Rule
14 − public TestWatcher testWatcher = new TestWatcher(){
15 − @Override
16 − protected final void succeeded(Description description) {
17 − super.succeeded(description);
18 − }
19 − 20 − @Override
21 − protected final void failed(Throwable e, Description description) {
22 − super.failed(e, description);
23 − }
24 − };
25 25 26 26 @Test
27 27 public final void testMultiply() {
28 28 Assert.assertEquals("The two values should multiply together", 50, java.multiply(10, 5));
29 29 }
30 30 }
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)))