tests improvements

This commit is contained in:
rusefillc 2021-01-07 04:18:30 -05:00
parent 2f5778c39b
commit f49f48dcc3
4 changed files with 47 additions and 9 deletions

View File

@ -21,16 +21,16 @@ public class ChangesModel {
private static final String COPY = "copy";
private static final String MERGE_NET = "merge_net";
public final Set<String> DEL_REQUESTS = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
public final List<NameAndOffset> ADD_REQUESTS = new ArrayList<NameAndOffset>();
public final List<NameAndOffset> MOVE_REQUESTS = new ArrayList<NameAndOffset>();
public final Set<String> DEL_REQUESTS = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
public final List<NameAndOffset> ADD_REQUESTS = new ArrayList<>();
public final List<NameAndOffset> MOVE_REQUESTS = new ArrayList<>();
public final List<TwoFileRequest> OPTIMIZE_REQUESTS = new ArrayList<TwoFileRequest>();
public final List<TwoFileRequest> COPY_REQUESTS = new ArrayList<TwoFileRequest>();
public final List<TwoFileRequest> OPTIMIZE_REQUESTS = new ArrayList<>();
public final List<TwoFileRequest> COPY_REQUESTS = new ArrayList<>();
/**
* Old net name > New net name
*/
public final Map<String, String> NET_MERGE_REQUESTS = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
public final Map<String, String> NET_MERGE_REQUESTS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
public static ChangesModel getInstance() {
return instance;

View File

@ -78,7 +78,7 @@ public class PcbMergeTool {
return null;
}
private static void mergePcb(PcbNode destNode, PcbNode source) throws IOException {
static void mergePcb(PcbNode destNode, PcbNode source) throws IOException {
/**
* original local net name > new net name in combined PCB
*/

View File

@ -1,15 +1,52 @@
package com.rusefi.pcb;
import com.rusefi.pcb.PcbMergeTool;
import com.rusefi.pcb.nodes.PcbNode;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
public class PcbMergeTest {
@Test
public void testMerge() throws IOException {
PcbNode destNode = PcbNode.readFromFile("pcb/test.kicad_pcb");
assertEquals(605, destNode.children.size());
PcbNode pcb = PcbNode.readFromFile("pcb/adc_amp_divider.kicad_pcb");
assertEquals(1036, pcb.children.size());
PcbMergeTool.mergePcb(destNode, pcb);
assertEquals(1541, destNode.children.size());
}
@Test
public void test() throws IOException {
PcbMergeTool.main(new String[]{"pcb/test.kicad_pcb",
"pcb/out.kicad_pcb",
"out.kicad_pcb",
"pcb/changes.txt"});
}
@Test
public void testAdc() throws IOException {
PcbMergeTool.main(new String[]{"pcb/adc_amp_divider.kicad_pcb",
"out_adc.kicad_pcb",
"pcb/empty.txt"});
}
@Test
public void testBreakout() throws IOException {
PcbMergeTool.main(new String[]{"pcb_read/Breakout_80pin_1393476-Connector.kicad_pcb",
"out_breakout.kicad_pcb",
"pcb/empty.txt"});
}
@Test
@Ignore
public void testProteus() throws IOException {
PcbMergeTool.main(new String[]{"pcb_read/proteus.kicad_pcb",
"out_proteus.kicad_pcb",
"pcb/empty.txt"});
}
}

View File

@ -0,0 +1 @@