Debian Codegraph @

test/footleg/cavesurvey/regression/PocketTopoToToporobotTest.java

raw symbols SCIP
1 /**
2 * Copyright (C) 2009-2016 Paul Fretwell - aka 'Footleg' ([email protected])
3 *
4 * This file is part of Cave Converter.
5 *
6 * Cave Converter is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Cave Converter is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Cave Converter. If not, see <http://www.gnu.org/licenses/>.
18 */
19 package footleg.cavesurvey.regression;
20
21 import static org.junit.Assert.*;
22
23 import java.io.FileNotFoundException;
24 import java.text.ParseException;
25
26 import org.junit.Test;
27
28 import footleg.cavesurvey.converter.CaveConverter.CmdlineOpt;
29 import footleg.cavesurvey.converter.CaveConverter.CmdlineSplaysOpt;
30 import footleg.cavesurvey.tools.TestHelper;
31
32 /**
33 * Regression test class which runs data file conversions and compares the output with reference
34 * files. Tests pass if the output file is identical to the reference file. A file name prefix
35 * is given as the argument for each test conversion. The test will look for an input file with
36 * this prefix and the suffix '_in.txt' and compare the output with a reference file with
37 * this prefix and the suffix '_ref.text'.
38 *
39 * @author Footleg
40 * @version 2016.12.14 (ISO 8601 YYYY.MM.DD)
41 * @since 1.6 (The Java version used)
42 */
43 public class PocketTopoToToporobotTest {
44
45 @Test
46 public void testPocketTopoToToporobotGourAven() throws ParseException, FileNotFoundException {
47 //Convert PocketTopo text export file to Toporobot format data
48 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "GourAven", CmdlineSplaysOpt.Default, CmdlineOpt.T,
49 RunFileConverter.defaultCharset );
50 assertEquals("Comparing GourAven toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
51 }
52
53 @Test
54 public void testPocketTopoToToporobotHSC() throws ParseException, FileNotFoundException {
55 //Convert PocketTopo text export file to Toporobot format data
56 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "HSC", CmdlineSplaysOpt.Default, CmdlineOpt.T,
57 RunFileConverter.defaultCharset );
58 assertEquals("Comparing HSC toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
59 }
60
61 @Test
62 public void testPocketTopoToToporobotStomps() throws ParseException, FileNotFoundException {
63 //Convert PocketTopo text export file to Toporobot format data
64 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "Stomps", CmdlineSplaysOpt.Default, CmdlineOpt.T,
65 RunFileConverter.defaultCharset );
66 assertEquals("Comparing Stomps toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
67 }
68
69 @Test
70 public void testPocketTopoToToporobotUzuGour() throws ParseException, FileNotFoundException {
71 //Convert PocketTopo text export file to Toporobot format data
72 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "Uzu-Gour", CmdlineSplaysOpt.Default, CmdlineOpt.T,
73 RunFileConverter.defaultCharset );
74 assertEquals("Comparing Uzu-Gour toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
75 }
76
77 @Test
78 public void testPocketTopoToToporobotSloppy2ZigZags() throws ParseException, FileNotFoundException {
79 //Test for older JRE as test result is different due to JRE rounding bug
80 boolean oldJRE = TestHelper.jreRoundingBug();
81 RunFileConverter.setOldJRE(oldJRE);
82 //Convert PocketTopo text export file to Toporobot format data
83 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "Sloppy2ZigZags", CmdlineSplaysOpt.Default, CmdlineOpt.T,
84 RunFileConverter.defaultCharset );
85 //Reset oldJRE flag for subsequent tests
86 RunFileConverter.setOldJRE(false);
87 assertEquals("Comparing Sloppy2ZigZags toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
88 }
89
90 @Test
91 public void testPocketTopoToToporobotTripComment() throws ParseException, FileNotFoundException {
92 //Convert PocketTopo text export file to Toporobot format data
93 String fileCompare = RunFileConverter.convertPocketTopoToToporobot( "TripComment", CmdlineSplaysOpt.Default, CmdlineOpt.T,
94 RunFileConverter.defaultCharset );
95 assertEquals("Comparing TripComment toporobot file from PocketTopo with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
96 }
97
98 }