Debian Codegraph @

test/footleg/cavesurvey/regression/SurvexToToporobotTest.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
31 /**
32 * Regression test class which runs data file conversions and compares the output with reference
33 * files. Tests pass if the output file is identical to the reference file. A file name prefix
34 * is given as the argument for each test conversion. The test will look for an input file with
35 * this prefix and the suffix '_in.svx' and compare the output with a reference file with
36 * this prefix and the suffix '_ref.text'.
37 *
38 * @author Footleg
39 * @version 2016.12.14 (ISO 8601 YYYY.MM.DD)
40 * @since 1.6 (The Java version used)
41 */
42 public class SurvexToToporobotTest {
43
44 @Test
45 public void testCrossoverCmdline() throws ParseException, FileNotFoundException {
46 //Convert Survex data file to Toporobot text format using default settings and test result
47 String fileCompare = RunFileConverter.convertUsingCmdLine("Crossover", 's', 't', "");
48 assertEquals("Comparing Crossover Toporobot file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
49 }
50
51 @Test
52 public void testFlagsSplaysCmdline() throws ParseException, FileNotFoundException {
53 //Convert Survex data file to Toporobot text format retaining splays and test result
54 String fileCompare = RunFileConverter.convertUsingCmdLine("flags", 's', 't', "splays");
55 assertEquals("Comparing Flags Toporobot file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
56 }
57
58 @Test
59 public void testSwilEnt() throws ParseException, FileNotFoundException {
60 //Convert Survex data file to Toporobot text format removing splays but generating LRUD data from them and test result
61 String fileCompare = RunFileConverter.convertSurvexToTopoRobot( "SwilEnt", CmdlineSplaysOpt.None, CmdlineOpt.T,
62 RunFileConverter.defaultCharset );
63 assertEquals("Comparing SwilEnt Toporobot file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
64 }
65
66 @Test
67 public void testCaseInsensitive() throws ParseException, FileNotFoundException {
68 //Convert Survex data file to Toporobot text format removing splays but generating LRUD data from them and test result
69 String fileCompare = RunFileConverter.convertSurvexToTopoRobot( "CaseInsensitive", CmdlineSplaysOpt.None, CmdlineOpt.T,
70 RunFileConverter.defaultCharset );
71 assertEquals("Comparing CaseInsensitive Toporobot file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
72 }
73
74 }