diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-05-20 21:39:50 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-05-20 21:39:50 +1200 |
commit | f5d56c4fcc88ec0edb3296b6bb572ff30860abd2 (patch) | |
tree | 02a9f10d1bab2f48ca0ff22811498f328368277c | |
parent | 551b941599d95dd8fb26dead74dca44e9e7a2c9b (diff) | |
download | trackermap-server-f5d56c4fcc88ec0edb3296b6bb572ff30860abd2.tar.gz trackermap-server-f5d56c4fcc88ec0edb3296b6bb572ff30860abd2.tar.bz2 trackermap-server-f5d56c4fcc88ec0edb3296b6bb572ff30860abd2.zip |
Add unit tests
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/H02ProtocolDecoderTest.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/Pt502ProtocolDecoderTest.java | 3 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 0b6d9e560..ba2e11eae 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -99,6 +99,9 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { lonlitude += Double.valueOf(parser.group(index++)) / 60; if (parser.group(index++).compareTo("W") == 0) lonlitude = -lonlitude; position.setLongitude(lonlitude); + + // Altitude + position.setAltitude(0.0); // Speed position.setSpeed(Double.valueOf(parser.group(index++))); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 235373113..fe63ea905 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -13,6 +13,9 @@ public class H02ProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, + "*HQ,3800008786,V1,062507,V,3048.2437,N,03058.5617,E,000.00,000,250413,FFFFFBFF")); + + assertNotNull(decoder.decode(null, null, "*HQ,123456789012345,V1,155850,A,5214.5346,N,2117.4683,E,0.00,270.90,131012,ffffffff,000000,000000,000000,000000")); assertNotNull(decoder.decode(null, null, @@ -20,6 +23,7 @@ public class H02ProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "*HQ,354188045498669,V1,195200,A,701.8915,S,3450.3399,W,0.00,205.70,050213,ffffffff,000243,000000,000000")); + } diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index c8a33037c..8fdbd4caf 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -25,6 +25,9 @@ public class Pt502ProtocolDecoderTest { /*assertNotNull(decoder.decode(null, null, "$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//"));*/ + + assertNotNull(decoder.decode(null, null, + "$POS,353451000164,082405.000,A,1254.8501,N,10051.6752,E,0.00,237.99,160513,,,A/0000,0/0/55000//a71/")); } |