Debian Codegraph @

test/footleg/cavesurvey/regression/CompassToSurvexTest.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.dxf' and compare the output with a reference file with
36 * this prefix and the suffix '_ref.dxf'.
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 CompassToSurvexTest {
43
44 @Test
45 public void testCompassToSurvexMinimal() throws ParseException, FileNotFoundException {
46 //Convert Compass file with minimal length comments and flags to Survex format data
47 String fileCompare = RunFileConverter.convertCompassToSurvex( "Minimal", CmdlineSplaysOpt.Default, CmdlineOpt.F,
48 RunFileConverter.defaultCharset );
49 assertEquals("Comparing Minimal survex file from Compass with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
50 }
51
52 @Test
53 public void testCompassToSurvexCalTest() throws ParseException, FileNotFoundException {
54 //Convert Compass file with minimal length comments and flags to Survex format data
55 String fileCompare = RunFileConverter.convertCompassToSurvex( "CalTest", CmdlineSplaysOpt.Default, CmdlineOpt.F,
56 RunFileConverter.defaultCharset );
57 assertEquals("Comparing CalTest survex file from Compass with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
58 }
59
60 @Test
61 public void testCompassToSurvexOldHeadersTest() throws ParseException, FileNotFoundException {
62 //Convert Compass file with minimal length comments and flags to Survex format data
63 String fileCompare = RunFileConverter.convertCompassToSurvex( "OldCompassHeaders", CmdlineSplaysOpt.Default, CmdlineOpt.F,
64 RunFileConverter.defaultCharset );
65 assertEquals("Comparing OldCompassHeaders survex file from Compass with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
66 }
67
68 @Test
69 public void testCompassToSurvexAwkwardCharsANSITest() throws ParseException, FileNotFoundException {
70 //Convert ANSI format Compass file with extended character set station names to Survex format data
71 String fileCompare = RunFileConverter.convertCompassToSurvex( "AwkwardCharsANSI", CmdlineSplaysOpt.Default, CmdlineOpt.F,
72 "Cp1252" );
73 assertEquals("Comparing AwkwardChars survex file from ANSI Compass with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
74 }
75
76 @Test
77 public void testCompassToSurvexAwkwardCharsUTF8Test() throws ParseException, FileNotFoundException {
78 //Convert UTF8 format Compass file with extended character set station names to Survex format data
79 String fileCompare = RunFileConverter.convertCompassToSurvex( "AwkwardCharsUTF8", CmdlineSplaysOpt.Default, CmdlineOpt.F,
80 "UTF8" );
81 assertEquals("Comparing AwkwardChars survex file from UTF8 Compass with reference.", DiffFiles.FILES_IDENTICAL, fileCompare);
82 }
83
84 }