|
10 | 10 | * Created by fishercoder on 5/3/17.
|
11 | 11 | */
|
12 | 12 | public class _201Test {
|
13 |
| - private static _201 test; |
| 13 | + private static _201.Solution1 solution1; |
14 | 14 | private static int m;
|
15 | 15 | private static int n;
|
16 | 16 | private static int actual;
|
17 | 17 | private static int expected;
|
18 | 18 |
|
19 | 19 | @BeforeClass
|
20 | 20 | public static void setup() {
|
21 |
| - test = new _201(); |
| 21 | + solution1 = new _201.Solution1(); |
22 | 22 | }
|
23 | 23 |
|
24 | 24 | @Test
|
25 | 25 | public void test1() {
|
26 | 26 | m = 5;
|
27 | 27 | n = 7;
|
28 |
| - actual = test.rangeBitwiseAnd_TLE(m, n); |
| 28 | + actual = solution1.rangeBitwiseAnd(m, n); |
29 | 29 | expected = 4;
|
30 | 30 | assertEquals(expected, actual);
|
31 |
| - actual = test.rangeBitwiseAnd(m, n); |
| 31 | + actual = solution1.rangeBitwiseAnd(m, n); |
32 | 32 | assertEquals(expected, actual);
|
33 | 33 | }
|
34 | 34 |
|
35 | 35 | @Test
|
36 | 36 | public void test2() {
|
37 | 37 | m = 1;
|
38 | 38 | n = 2;
|
39 |
| - actual = test.rangeBitwiseAnd_TLE(m, n); |
| 39 | + actual = solution1.rangeBitwiseAnd(m, n); |
40 | 40 | expected = 0;
|
41 | 41 | assertEquals(expected, actual);
|
42 |
| - actual = test.rangeBitwiseAnd(m, n); |
| 42 | + actual = solution1.rangeBitwiseAnd(m, n); |
43 | 43 | assertEquals(expected, actual);
|
44 | 44 | }
|
45 | 45 |
|
46 | 46 | @Test
|
47 | 47 | public void test3() {
|
48 | 48 | m = 0;
|
49 | 49 | n = 2147483647;
|
50 |
| - long start = System.currentTimeMillis(); |
51 |
| - actual = test.rangeBitwiseAnd_TLE(m, n); |
52 |
| - System.out.println("It took " + (System.currentTimeMillis() - start) + " ms to finish."); |
| 50 | + actual = solution1.rangeBitwiseAnd(m, n); |
53 | 51 | expected = 0;
|
54 | 52 | assertEquals(expected, actual);
|
55 |
| - actual = test.rangeBitwiseAnd(m, n); |
| 53 | + actual = solution1.rangeBitwiseAnd(m, n); |
56 | 54 | assertEquals(expected, actual);
|
57 | 55 | }
|
58 | 56 |
|
59 | 57 | @Test
|
60 | 58 | public void test4() {
|
61 | 59 | m = 20000;
|
62 | 60 | n = 2147483647;
|
63 |
| - long start = System.currentTimeMillis(); |
64 |
| -// actual = test.rangeBitwiseAnd_TLE(m, n); |
65 |
| - System.out.println("It took " + (System.currentTimeMillis() - start) + " ms to finish."); |
| 61 | + actual = solution1.rangeBitwiseAnd(m, n); |
66 | 62 | expected = 0;
|
67 | 63 | assertEquals(expected, actual);
|
68 |
| - actual = test.rangeBitwiseAnd(m, n); |
| 64 | + actual = solution1.rangeBitwiseAnd(m, n); |
69 | 65 | assertEquals(expected, actual);
|
70 | 66 | }
|
71 | 67 | }
|
0 commit comments