NMEA-0183 语句解析器,含 21 个语句类型 codec 与配套单元测试。 - codecs/:APB/BWC/DBT/GGA/GLL/GRMT/GSA/GSV/HDG/HDM/HDT/MWV/RDID/ RMB/RMC/ROT/RSA/TXT/VTG/VWR/ZDA - test/:各 codec 对应的 mocha 用例 - .github/workflows/:node与 npm-publish 流水线 许可证:MIT(原作者 James Penn)
23 lines
732 B
JavaScript
23 lines
732 B
JavaScript
var should = require('should');
|
|
|
|
describe('DBT parsing', function () {
|
|
it('parses feet and meters', function () {
|
|
var msg = require("../nmea.js").parse("$IIDBT,036.41,f,011.10,M,005.99,F*25");
|
|
msg.should.have.property('sentence', 'DBT');
|
|
msg.should.have.property('type', 'depth-transducer');
|
|
msg.should.have.property('depthFeet', 36.41);
|
|
msg.should.have.property('depthMeters', 11.10);
|
|
});
|
|
});
|
|
|
|
describe('DBT encoding', function () {
|
|
it('encodes ok', function () {
|
|
var nmeaMsg = require("../nmea.js").encode('II', {
|
|
type: 'depth-transducer',
|
|
depthFeet: 36.41,
|
|
depthFathoms: 5.99,
|
|
depthMeters: 11.10
|
|
});
|
|
nmeaMsg.should.equal("$IIDBT,36.41,f,11.10,M,5.99,F*25");
|
|
});
|
|
}); |