Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 41c0c7f

Browse files
committed
新建开发分支
1 parent 7b96cdb commit 41c0c7f

File tree

2 files changed

+53
-53
lines changed

2 files changed

+53
-53
lines changed

.classpath

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
</attributes>
1919
</classpathentry>
2020
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
21-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
2226
<classpathentry kind="output" path="target/classes"/>
2327
</classpath>
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
1-
/**
2-
*
3-
*/
41
package com.zhazhapan.util;
52

3+
import org.junit.Test;
4+
65
import static org.junit.Assert.assertEquals;
76
import static org.junit.Assert.assertTrue;
87

9-
import org.junit.Test;
10-
118
/**
129
* @author pantao
13-
*
1410
*/
1511
public class UtilsTest {
1612

17-
int[] test1 = { 78, 56, 34, 23, 12, 1 };
18-
int[] test2 = { 45, 33, 32, 23, 22, 13 };
19-
int[] test3 = { 1, 2, 4, 6, 9 };
20-
int[] test4 = { 3, 5, 7, 8 };
21-
22-
@Test
23-
public void testNumberExtract() {
24-
String s1 = "+.12 3";
25-
String s2 = "+ab12.c123 ";
26-
String s3 = "+0.c123";
27-
String s4 = " +89h.7.123";
28-
String s5 = "afda.afaa";
29-
String s6 = "-.abca";
30-
String s7 = "-.1 2-3";
31-
String s8 = "-8afa232.123";
32-
String s9 = "-0.123";
33-
assertTrue(123 == Utils.extractInt(s1));
34-
assertTrue(12123 == Utils.extractInt(s2));
35-
assertTrue(0.123 == Utils.extractDouble(s3));
36-
assertTrue(897.123 == Utils.extractDouble(s4));
37-
assertTrue("" == Utils.extractDigit(s5));
38-
assertTrue("" == Utils.extractDigit(s6));
39-
assertTrue(-0.123 == Utils.extractDouble(s7));
40-
assertTrue(-8232123 == Utils.extractInt(s8));
41-
assertTrue(-0.123f == Utils.extractFloat(s9));
42-
}
43-
44-
@Test
45-
public void testConcatArrays() {
46-
int[] nums = Utils.concatArrays(test1, test2, test4, test3);
47-
for (int i : nums) {
48-
System.out.print(i + " ");
49-
}
50-
}
51-
52-
@Test
53-
public void testGetMaxValue() {
54-
int[] test1 = { 1, 2, 3, 2, 123, 34 };
55-
assertEquals(123, Utils.getMaxValue(test1));
56-
}
57-
58-
@Test
59-
public void testMerageSortedArrays() {
60-
assertTrue(Checker.isSorted(Utils.mergeSortedArrays(test1, test2, true)));
61-
assertTrue(Checker.isSorted(Utils.mergeSortedArrays(test4, test3)));
62-
}
13+
private int[] test1 = {78, 56, 34, 23, 12, 1};
14+
private int[] test2 = {45, 33, 32, 23, 22, 13};
15+
private int[] test3 = {1, 2, 4, 6, 9};
16+
private int[] test4 = {3, 5, 7, 8};
17+
18+
@Test
19+
public void testNumberExtract() {
20+
String s1 = "+.12 3";
21+
String s2 = "+ab12.c123 ";
22+
String s3 = "+0.c123";
23+
String s4 = " +89h.7.123";
24+
String s5 = "afda.afaa";
25+
String s6 = "-.abca";
26+
String s7 = "-.1 2-3";
27+
String s8 = "-8afa232.123";
28+
String s9 = "-0.123";
29+
assertTrue(123 == Utils.extractInt(s1));
30+
assertTrue(12123 == Utils.extractInt(s2));
31+
assertTrue(0.123 == Utils.extractDouble(s3));
32+
assertTrue(897.123 == Utils.extractDouble(s4));
33+
assertTrue("".equals(Utils.extractDigit(s5)));
34+
assertTrue("".equals(Utils.extractDigit(s6)));
35+
assertTrue(-0.123 == Utils.extractDouble(s7));
36+
assertTrue(-8232123 == Utils.extractInt(s8));
37+
assertTrue(-0.123f == Utils.extractFloat(s9));
38+
}
39+
40+
@Test
41+
public void testConcatArrays() {
42+
int[] nums = Utils.concatArrays(test1, test2, test4, test3);
43+
for (int i : nums) {
44+
System.out.print(i + " ");
45+
}
46+
}
47+
48+
@Test
49+
public void testGetMaxValue() {
50+
int[] test1 = {1, 2, 3, 2, 123, 34};
51+
assertEquals(123, Utils.getMaxValue(test1));
52+
}
53+
54+
@Test
55+
public void testMerageSortedArrays() {
56+
assertTrue(Checker.isSorted(Utils.mergeSortedArrays(test1, test2, true)));
57+
assertTrue(Checker.isSorted(Utils.mergeSortedArrays(test4, test3)));
58+
}
6359
}

0 commit comments

Comments
 (0)