-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.java
98 lines (82 loc) · 3.12 KB
/
tests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* tests.java - Tests for methods in SyncSubLib.java
*
* @author Matt Mokary ( [email protected] )
*/
/**
* Tests for methods in SyncSubLib.java
*/
class Tests extends SyncSubLib {
// writing my own testing function because JUnit outside of an IDE is hard
private static void assertTrue( boolean ex ) {
if ( ex ) { System.out.print( "." ); }
else { System.out.print( "X" ); }
}
// ---------------------------------------------------------------------------
private static void test_updateLine1() {
String[] s = { "Some Text" };
assertTrue( updateLine(s).equals( "Some Text" ) );
}
private static void test_updateLine2() {
setData( PLUS, 0, 0, 1, 0 );
String[] s = { "00:00:00,000", "00:00:00,000" };
assertTrue( updateLine(s).equals( "00:00:01,000 --> 00:00:01,000" ) );
}
private static void test_updateLine3() {
setData( MINUS, 0, 0, 1, 0 );
String[] s = { "00:00:00,000", "00:00:00,000" };
assertTrue( updateLine(s).equals( "00:00:00,000 --> 00:00:00,000" ) );
}
private static void test_updateLine4() {
setData( MINUS, 0, 0, 0, 500 );
String[] s = { "00:00:01,000", "00:00:01,000" };
assertTrue( updateLine(s).equals( "00:00:00,500 --> 00:00:00,500" ) );
}
private static void test_updateLine5() {
setData( PLUS, 0, 0, 1, 0 );
String[] s = { "00:00:59,000", "00:00:59,000" };
assertTrue( updateLine(s).equals( "00:01:00,000 --> 00:01:00,000" ) );
}
private static void test_updateLine6() {
setData( PLUS, 0, 1, 0, 0 );
String[] s = { "00:59:00,000", "00:59:00,000" };
assertTrue( updateLine(s).equals( "01:00:00,000 --> 01:00:00,000" ) );
}
private static void test_updateLine7() {
setData( MINUS, 0, 1, 0, 0 );
String[] s = { "01:00:00,000", "01:00:00,000" };
assertTrue( updateLine(s).equals( "00:59:00,000 --> 00:59:00,000" ) );
}
private static void test_updateLine8() {
setData( PLUS, 0, 1, 0, 0 );
String[] s = { "99:59:00,000", "99:59:00,000" };
assertTrue( updateLine(s).equals( "99:00:00,000 --> 99:00:00,000" ) );
}
private static void test_updateLine9() {
setData( MINUS, 0, 0, 0, 500 );
String[] s = { "01:00:00,000", "01:00:00,000" };
assertTrue( updateLine(s).equals( "00:59:59,500 --> 00:59:59,500" ) );
}
private static void test_updateLine10() {
setData( MINUS, 0, 0, 1, 0 );
String[] s = { "00:01:00,000", "00:00:00,000" };
assertTrue( updateLine(s).equals( "00:00:59,000 --> 00:00:00,000" ) );
}
// ---------------------------------------------------------------------------
public static void main( String[] args ) {
runTests();
}
private static void runTests() {
test_updateLine1();
test_updateLine2();
test_updateLine3();
test_updateLine4();
test_updateLine5();
test_updateLine6();
test_updateLine7();
test_updateLine8();
test_updateLine9();
test_updateLine10();
System.out.print("\n");
}
}