File tree Expand file tree Collapse file tree 3 files changed +248
-147
lines changed
com/google/openlocationcode Expand file tree Collapse file tree 3 files changed +248
-147
lines changed Original file line number Diff line number Diff line change
1
+ # Ignore class and jar files
2
+ * .class
3
+ * .jar
Original file line number Diff line number Diff line change
1
+ # Java Open Location Code library
2
+
3
+ ## Building
4
+
5
+ Create an empty ` build ` directory:
6
+
7
+ ``` shell
8
+ mkdir build
9
+ ```
10
+
11
+ Compile the ` com/google/openlocationcode/OpenLocationCode.java ` file and then
12
+ package it as a jar file:
13
+
14
+ ``` shell
15
+ javac -d build com/google/openlocationcode/OpenLocationCode.java
16
+ cd build
17
+ jar cvf OpenLocationCode.jar com/google/openlocationcode/OpenLocationCode* .class
18
+ cd ..
19
+ ```
20
+ That's it - you'll have a jar file in ` build/OpenLocationCode.jar ` .
21
+
22
+ ## Testing
23
+
24
+ Download the ` junit ` and ` hamcrest ` jar files from [ their repository] ( https://github.com/junit-team/junit4/wiki/Download-and-Install )
25
+ and place them somewhere.
26
+
27
+ (This will assume you downloaded ` junit-41.2.jar ` and ` hamcrest-core-1.3.jar ` )
28
+
29
+ Build the ` OpenLocationCode.jar ` file as above.
30
+
31
+ Add all three files to your ` CLASSPATH ` variable (obviously use the real paths to the files):
32
+
33
+ ``` shell
34
+ CLASSPATH=$CLASSPATH :build/OpenLocationCode.jar:/path/to/junit-4.12.jar:/path/to/hamcrest-core-1.3.jar
35
+ ```
36
+
37
+ Compile the test classes:
38
+
39
+ ``` shell
40
+ javac -cp $CLASSPATH -d build com/google/openlocationcode/tests/* java
41
+ ```
42
+
43
+ Run the tests. Note that we need to use the ` -cp ` argument to give the location of the test classes and the test data files:
44
+
45
+ ``` shell
46
+ java -cp $CLASSPATH :build:../test_data: org.junit.runner.JUnitCore com.google.openlocationcode.tests.EncodingTest com.google.openlocationcode.tests.PrecisionTest com.google.openlocationcode.tests.ShorteningTest com.google.openlocationcode.tests.ValidityTest
47
+ ```
You can’t perform that action at this time.
0 commit comments