Changeset 655 in tmcsimulator for trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java
- Timestamp:
- 09/11/2022 04:28:42 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/tmcsim/cadsimulator/CADSimulatorConsoleTest.java
r653 r655 30 30 private CADConsoleViewer console; 31 31 private StringWriter sw; 32 32 // Setup a path for temp files 33 static String tmpPath = "/tmp/";// default path is for linux 34 static 35 { 36 String myOs = System.getProperty("os.name").toLowerCase(); 37 if (myOs.indexOf("win") >= 0) 38 { 39 tmpPath = "C:/TEMP/"; // alt path for Windows 40 } 41 } 33 42 public CADSimulatorConsoleTest(String testName) 34 43 { … … 70 79 71 80 /** 72 * compare StringWriter contents against expected81 * obsolete: compare StringWriter contents against expected 73 82 */ 74 private void verify (String msg, String expect)83 private void verify0(String msg, String expect) 75 84 { 76 85 String result = sw.toString().trim(); … … 85 94 assertTrue(msg + ": " + result, match); 86 95 } 87 96 /** compare StringWriter contents against expected 97 * @param expected contains just the most recent lines of output 98 * @param errmsg message to be displayed if test fails 99 * improved to verify line by line 100 */ 101 private void verify(String errmsg, String expect) 102 { 103 String[] results = sw.toString().trim().split("\n"); // split into lines 104 String[] expecteds = expect.trim().split("\n"); 105 // Work backwards from the most recent line of output 106 for (int item=expecteds.length-1; item >= 0; item--) 107 { 108 //System.out.println("Verifying "+expecteds[item]+" against "+results[item]); 109 assertEquals(errmsg + " line "+item, expecteds[item], results[item]); 110 } 111 } 88 112 public static void pause(int millis) 89 113 { … … 134 158 CADClientInterface ci = mock(CADClientInterface.class); 135 159 app.theCoordinator.registerForCallback(ci); 160 pause(500); 136 161 verify("connected 1 terminal output incorrect: ", expected2); 137 162 String expected3 = … … 286 311 +"FEPSim_IP_addr = localhost\n" 287 312 +"Output_Destination = Console\n" 288 +"Highway_Status_File = /tmp/highway_status.json\n";313 +"Highway_Status_File = "+tmpPath+"highway_status.json\n"; 289 314 static final String paramicsData = "ParamicsCommHost = 127.0.0.1\n" 290 315 + "ParamicsCommPort = 4450\n"
Note: See TracChangeset
for help on using the changeset viewer.
