-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestDistance.java
88 lines (65 loc) · 2.29 KB
/
TestDistance.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
//Name: Tianren Wang
//Student ID: 6040795
//ITI 1121-A00
//Assignment 5
import java.io.IOException;
import java.io.FileNotFoundException;
/** Minimalist tests for the class Distance.
*
* @author Marcel Turcotte ([email protected])
*/
public class TestDistance {
public static void main(String[] args) {
System.out.println("");
StudentInfo.display();
System.out.println("");
String a = "ACACACACACACACACACACACACACACACACACACACAC";
String b = "ACACACACACACACACACACCACACACACACACACACACAC";
String c = "ACACACACACACACACACACCACACACACACACACACCCAC";
String d = "ACACACACACACACACACACCACACACACACACACACACACACACACACACACACACACACCACACACACACACACACACAC";
System.out.println(Distance.compare(5, a, a));
System.out.println(Distance.compare(5, a, b));
System.out.println(Distance.compare(5, a, c));
System.out.println(Distance.compare(5, a, d));
System.out.println(Distance.compare(5, b, c));
System.out.println(Distance.compare(5, b, d));
System.out.println(Distance.compare(5, c, d));
String e = null, f = null;
try {
e = Utils.readFile("data/NC_000913.txt");
f = Utils.readFile("data/NC_000908.txt");
} catch (IOException exception) {
System.err.println(exception);
System.exit(-1);
}
Utils.setType("LINEAR");
long start = System.nanoTime(), stop;
System.out.println(Distance.compare(5, e, f));
stop = System.nanoTime();
System.out.println("time = " + (stop-start) + " nano seconds");
Utils.setType("TREE");
start = System.nanoTime();
System.out.println(Distance.compare(5, e, f));
stop = System.nanoTime();
System.out.println("time = " + (stop-start) + " nano seconds");
}
}
// > java TestDistance
// ************************************************************
// * *
// * *
// * *
// * *
// ************************************************************
//
// 0.0
// 0.009130752373995615
// 0.031044558071585078
// 0.008218277449046676
// 0.008765522279035794
// 2.4012498024971943E-5
// 0.00946380572160198
// 0.0012225189741013151
// time = 10771698130 nano seconds
// 0.0012225189741013151
// time = 500109497 nano seconds