[2] | 1 | /*
|
---|
| 2 | * To change this template, choose Tools | Templates
|
---|
| 3 | * and open the template in the editor.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | package routegui;
|
---|
| 7 |
|
---|
| 8 | import java.io.IOException;
|
---|
| 9 | import org.junit.Test;
|
---|
| 10 | import static org.junit.Assert.*;
|
---|
| 11 | import static java.util.Calendar.*;
|
---|
| 12 | /**
|
---|
| 13 | *
|
---|
| 14 | * @author rick
|
---|
| 15 | */
|
---|
| 16 | public class GPRMCTest {
|
---|
| 17 |
|
---|
| 18 | @Test
|
---|
| 19 | public void GPRMCTest() {
|
---|
| 20 | /* Data entry check HHMMSS.XXX*/
|
---|
| 21 | GPRMC entry = new GPRMC("$GPRMC,080756.00,A,5159.38233,N,00422.72435,E,0.011,,120308,,,A*76");
|
---|
| 22 | assertEquals(2008, entry.calendar.get(YEAR));
|
---|
| 23 | assertEquals(03, entry.calendar.get(MONTH));
|
---|
| 24 | assertEquals(12, entry.calendar.get(DAY_OF_MONTH));
|
---|
| 25 | assertEquals(8, entry.calendar.get(HOUR));
|
---|
| 26 | assertEquals(7, entry.calendar.get(MINUTE));
|
---|
| 27 | assertEquals(56, entry.calendar.get(SECOND));
|
---|
| 28 | assertEquals(00, entry.calendar.get(MILLISECOND));
|
---|
| 29 | assertEquals(51.9897055, entry.position.getLatitude());
|
---|
| 30 | assertEquals(4.378739166666667, entry.position.getLongitude());
|
---|
| 31 | assertEquals(true, entry.sateliteFixStatus);
|
---|
| 32 | assertEquals(0.011, entry.speed);
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | /* Checksum check, should fail */
|
---|
| 36 | boolean result = entry.process("$GPRMC,080756.00,A,5159.38233,N,00422.72435,E,0.011,,120308,,,A*75");
|
---|
| 37 | assertEquals(false, result);
|
---|
| 38 | }
|
---|
| 39 | }
|
---|