aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-25 11:06:34 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-25 11:06:34 +1300
commit957740cfb5d74098971a8d4186eda4f9383774d8 (patch)
treed8fb3df0658a9a0ca45ee8a073aca3e82740eb1b /test
parent8fe177bd27196a3924e4ef8e835ba9dac14975c3 (diff)
downloadtrackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.tar.gz
trackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.tar.bz2
trackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.zip
Refactor Totem protocol decoder
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/helper/PatternBuilderTest.java3
-rw-r--r--test/org/traccar/protocol/TotemProtocolDecoderTest.java9
2 files changed, 9 insertions, 3 deletions
diff --git a/test/org/traccar/helper/PatternBuilderTest.java b/test/org/traccar/helper/PatternBuilderTest.java
index 427161758..10621693e 100644
--- a/test/org/traccar/helper/PatternBuilderTest.java
+++ b/test/org/traccar/helper/PatternBuilderTest.java
@@ -10,6 +10,9 @@ public class PatternBuilderTest {
Assert.assertEquals("\\$GPRMC", new PatternBuilder().text("$GPRMC").toString());
Assert.assertEquals("(\\d{2}\\.\\p{XDigit}+)", new PatternBuilder().number("(dd.x+)").toString());
Assert.assertEquals("a(?:bc)?", new PatternBuilder().text("a").text("b").text("c").optional(2).toString());
+ Assert.assertEquals("a|b", new PatternBuilder().expression("a|b").toString());
+ Assert.assertEquals("ab\\|", new PatternBuilder().expression("ab|").toString());
+ Assert.assertEquals("|", new PatternBuilder().or().toString());
}
}
diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
index 11bf03c85..373fbd6d1 100644
--- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
@@ -14,10 +14,12 @@ public class TotemProtocolDecoderTest extends ProtocolDecoderTest {
// $$0108AA864244026063437|1A0000001401010101014111000027BA0E57003100000000.000000000000.0000N00000.0000E048156
verifyPosition(decoder, text(
- "$$BE863771024392112|AA$GPRMC,044704.000,A,1439.3334,N,12059.1417,E,0.00,0.00,200815,,,A*67|01.7|00.8|01.4|000000000000|20150820044704|14291265|00000000|4EECBF8B31|0000|0.0000|0002|00000|56E7"));
+ "$$BE863771024392112|AA$GPRMC,044704.000,A,1439.3334,N,12059.1417,E,0.00,0.00,200815,,,A*67|01.7|00.8|01.4|000000000000|20150820044704|14291265|00000000|4EECBF8B31|0000|0.0000|0002|00000|56E7"),
+ position("2015-08-20 04:47:04.000", true, 14.65556, 120.98570));
verifyPosition(decoder, text(
- "$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324"));
+ "$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324"),
+ position("2015-03-14 05:10:02.000", true, 4.65437, 101.14907));
verifyPosition(decoder, text(
"$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324\r"));
@@ -32,7 +34,8 @@ public class TotemProtocolDecoderTest extends ProtocolDecoderTest {
"$$B2359772032984289|AA$GPRMC,104446.000,A,5011.3944,N,01439.6637,E,0.00,,290212,,,A*7D|01.8|00.9|01.5|000000100000|20120229104446|14151221|00050000|046D085E|0000|0.0000|1170|29A7"));
verifyPosition(decoder, text(
- "$$8B862170017861566|AA180613080657|A|2237.1901|N|11402.1369|E|1.579|178|8.70|100000001000|13811|00000000|253162F5|00000000|0.0000|0014|2B16"));
+ "$$8B862170017861566|AA180613080657|A|2237.1901|N|11402.1369|E|1.579|178|8.70|100000001000|13811|00000000|253162F5|00000000|0.0000|0014|2B16"),
+ position("2013-06-18 08:06:57.000", true, 22.61984, 114.03562));
verifyPosition(decoder, text(
"$$72862170017856731|3913090911165280000370000000000000000019BD508A0400000003.400000093644.9817N01012.9944E00506F2E"));