Skip to content

Commit

Permalink
Make tests work on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <sean@mess.org>
  • Loading branch information
seanyoung committed Apr 18, 2024
1 parent 0c94345 commit 923a310
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/harctoolbox/ircore/IrCoreUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public final class IrCoreUtils {
public final static long SOME = -3L;

public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String NEWLINE_REGEX = "\\r?\\n";

private static Map<Integer, String> radixPrefixes;
private static Map<String, Integer> prefixToRadix;
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/org/harctoolbox/irp/IrpTransmogrifierNGTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,23 @@ public void testDecodeNoRepeatedNec() {
System.out.println("decodeNoRepeatedNec");
String args = "decode --debug nec1 +9041 -4507 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -44293";
String result = execute(args);
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0].substring(0,21), "NEC: {D=12,S=34,F=56}");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0].substring(0,21), "NEC: {D=12,S=34,F=56}");
}

@Test(enabled = true)
public void testDecodeRepeatedNec1() {
System.out.println("decodeRepeatedNec1");
String args = "decode -p nec1 -r +9041 -4507 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -44293 +9041 -2267 +626 -96193 +9041 -2267 +626 -96193 +9041 -2267 +626 -96193 +9041 -2267 +626 -96193";
String result = execute(args);
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "NEC1: {D=12,S=34,F=56}");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "NEC1: {D=12,S=34,F=56}");
}

@Test(enabled = true)
public void testDecodeNec1OneDitto() {
System.out.println("testDecodeNec1OneDitto");
String args = "decode -p nec1 +9041 -4507 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -1694 +573 -573 +573 -573 +573 -573 +573 -1694 +573 -1694 +573 -44293 +9041 -2267 +626 -96193";
String result = execute(args);
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1");
}

@Test(enabled = true)
Expand All @@ -282,10 +282,10 @@ public void testDecodeNec1OneDittoNec1TwoDittoJunk() {
String sequence = NEC1INTRO + " " + NEC1DITTO + " " + NEC1INTRO + " " + NEC1DITTO + " " + NEC1DITTO + "+1234 -54678";
String args = "decode -p nec1 " + sequence;
String result = execute(args);
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1 {UNDECODED. length=78}");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1 {UNDECODED. length=78}");
args = "decode -p nec1 --recursive " + sequence;
result = execute(args);
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1 {NEC1: {D=12,S=34,F=56}, beg=72, end=147, reps=2 {UNDECODED. length=2}}");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "NEC1: {D=12,S=34,F=56}, beg=0, end=71, reps=1 {NEC1: {D=12,S=34,F=56}, beg=72, end=147, reps=2 {UNDECODED. length=2}}");
}

@Test(enabled = true)
Expand Down Expand Up @@ -624,56 +624,56 @@ public void testSillyCommand() {
public void testHelp() {
System.out.println("testHelp");
String result = execute("help");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
}

@Test(enabled = true)
public void testDashHelp() {
System.out.println("testDashHelp");
String result = execute("--help");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
}

@Test(enabled = true)
public void testHelpShort() {
System.out.println("testHelpShort");
String result = execute("help --short");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "Usage: IrpTransmogrifier [options] [command] [command options]");
}

@Test(enabled = true)
public void testHelpCommon() {
System.out.println("testHelpCommon");
String result = execute("help --common");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "Common options:");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "Common options:");
}

@Test(enabled = true)
public void testHelpDashHelp() {
System.out.println("testHelpDashHelp");
String result = execute("help --help");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "Describe the syntax of program and commands.");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "Describe the syntax of program and commands.");
}

@Test(enabled = true)
public void testHelpDescribe() {
System.out.println("testHelpDescribe");
String result = execute("help --describe");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "This command list the syntax for the command(s) given as argument,");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "This command list the syntax for the command(s) given as argument,");
}

@Test(enabled = true)
public void testHelpList() {
System.out.println("testHelpList");
String result = execute("help list");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "List protocols and their properties.");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "List protocols and their properties.");
}

@Test(enabled = true)
public void testListHelp() {
System.out.println("testListHelp");
String result = execute("list --help");
assertEquals(result.split(IrCoreUtils.LINE_SEPARATOR)[0], "List protocols and their properties.");
assertEquals(result.split(IrCoreUtils.NEWLINE_REGEX)[0], "List protocols and their properties.");
}

@Test(enabled = true)
Expand Down

0 comments on commit 923a310

Please sign in to comment.