| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public class SurvexToSurvexTest { |
| 43 |
|
| 44 |
@Test |
| 45 |
public void testNightMare() throws ParseException, FileNotFoundException { |
| 46 |
|
| 47 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "NightMare", CmdlineSplaysOpt.Default, CmdlineOpt.T, |
| 48 |
RunFileConverter.defaultCharset ); |
| 49 |
assertEquals("Comparing NightMare Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 50 |
} |
| 51 |
|
| 52 |
@Test |
| 53 |
public void testCalibrations() throws ParseException, FileNotFoundException { |
| 54 |
|
| 55 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "calibrations", CmdlineSplaysOpt.Default, CmdlineOpt.T, |
| 56 |
RunFileConverter.defaultCharset ); |
| 57 |
assertEquals("Comparing calibrations Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 58 |
} |
| 59 |
|
| 60 |
@Test |
| 61 |
public void testDataOrder() throws ParseException, FileNotFoundException { |
| 62 |
|
| 63 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "survex_different_data_order", CmdlineSplaysOpt.Default, |
| 64 |
CmdlineOpt.F, RunFileConverter.defaultCharset ); |
| 65 |
assertEquals("Comparing variations in data order Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 66 |
} |
| 67 |
|
| 68 |
@Test |
| 69 |
public void testNestedDataOrder() throws ParseException, FileNotFoundException { |
| 70 |
|
| 71 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "survex_data_order_nested", CmdlineSplaysOpt.Default, |
| 72 |
CmdlineOpt.F, RunFileConverter.defaultCharset ); |
| 73 |
assertEquals("Comparing variations in nested data order Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 74 |
} |
| 75 |
|
| 76 |
@Test |
| 77 |
public void testFlags() throws ParseException, FileNotFoundException { |
| 78 |
|
| 79 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "flags", CmdlineSplaysOpt.Default, CmdlineOpt.F, |
| 80 |
RunFileConverter.defaultCharset ); |
| 81 |
assertEquals("Comparing flags Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 82 |
} |
| 83 |
|
| 84 |
@Test |
| 85 |
public void testNestedFlags() throws ParseException, FileNotFoundException { |
| 86 |
|
| 87 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "nested_series_flags", CmdlineSplaysOpt.Named, CmdlineOpt.F, |
| 88 |
RunFileConverter.defaultCharset ); |
| 89 |
assertEquals("Comparing nested flags Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 90 |
} |
| 91 |
|
| 92 |
@Test |
| 93 |
public void testNosurvey() throws ParseException, FileNotFoundException { |
| 94 |
|
| 95 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "nosurvey", CmdlineSplaysOpt.Default, CmdlineOpt.F, |
| 96 |
RunFileConverter.defaultCharset ); |
| 97 |
assertEquals("Comparing nosurvey Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 98 |
} |
| 99 |
|
| 100 |
@Test |
| 101 |
public void testAnonymousBlocks() throws ParseException, FileNotFoundException { |
| 102 |
|
| 103 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "anonymous_blocks", CmdlineSplaysOpt.Named, CmdlineOpt.F, |
| 104 |
RunFileConverter.defaultCharset ); |
| 105 |
assertEquals("Comparing anonymous blocks Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 106 |
} |
| 107 |
|
| 108 |
@Test |
| 109 |
public void testUnits() throws ParseException, FileNotFoundException { |
| 110 |
|
| 111 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "units_test", CmdlineSplaysOpt.Default, |
| 112 |
CmdlineOpt.F, RunFileConverter.defaultCharset ); |
| 113 |
assertEquals("Comparing all units Survex file from Survex with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 114 |
} |
| 115 |
|
| 116 |
@Test |
| 117 |
public void testSurvexEverything() throws ParseException, FileNotFoundException { |
| 118 |
|
| 119 |
String fileCompare = RunFileConverter.convertSurvexToSurvex( "survex_everything", CmdlineSplaysOpt.Anon, |
| 120 |
CmdlineOpt.F, RunFileConverter.defaultCharset ); |
| 121 |
assertEquals("Comparing Survex file from Survex file containing everything survex supports with reference.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 122 |
} |
| 123 |
|
| 124 |
@Test |
| 125 |
public void testSwilEntNosplays() throws ParseException, FileNotFoundException { |
| 126 |
|
| 127 |
String fileCompare = RunFileConverter.convertUsingCmdLine("SwilEnt", 's', 's', "nosplays lrud"); |
| 128 |
assertEquals("Comparing SwilEnt Survex file from Survex with reference, removing splays.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 129 |
} |
| 130 |
|
| 131 |
@Test |
| 132 |
public void testSwilEntSplaysLRUD() throws ParseException, FileNotFoundException { |
| 133 |
|
| 134 |
String fileCompare = RunFileConverter.convertUsingCmdLine("SwilEnt", 's', 's', "splays lrud"); |
| 135 |
assertEquals("Comparing SwilEnt Survex file from Survex with reference, removing splays.", DiffFiles.FILES_IDENTICAL, fileCompare); |
| 136 |
} |
| 137 |
|
| 138 |
} |