| Index: pkg/mdns/test/decode_test.dart
|
| diff --git a/pkg/mdns/test/decode_test.dart b/pkg/mdns/test/decode_test.dart
|
| index 1f7a913d074260c565b0fb4561c2757bf571bd0e..7a04b6ad6fa3298a2cd5989cc49e4d813caccfd1 100644
|
| --- a/pkg/mdns/test/decode_test.dart
|
| +++ b/pkg/mdns/test/decode_test.dart
|
| @@ -3,12 +3,15 @@
|
| // BSD-style license that can be found in the LICENSE.md file.
|
|
|
| import 'package:expect/expect.dart';
|
| +import 'package:mdns/src/constants.dart';
|
| import 'package:mdns/src/packet.dart';
|
|
|
| main() {
|
| testValidPackages();
|
| testBadPackages();
|
| testHexDumpList();
|
| + testPTRRData();
|
| + testSRVRData();
|
| }
|
|
|
| testValidPackages() {
|
| @@ -58,6 +61,18 @@ testBadPackages() {
|
| }
|
| }
|
|
|
| +testPTRRData() {
|
| + Expect.equals(
|
| + 'sgjesse-macbookpro2 [78:31:c1:b8:55:38]._workstation._tcp.local',
|
| + readFQDN(ptrRData));
|
| + print(readFQDN(ptrRData2));
|
| + Expect.equals('fletch-agent._fletch_agent._tcp.local', readFQDN(ptrRData2));
|
| +}
|
| +
|
| +testSRVRData() {
|
| + Expect.equals('fletch.local', readFQDN(srvRData, srvHeaderSize));
|
| +}
|
| +
|
| testHexDumpList() {
|
| // Call hexDumpList to get rid of hint.
|
| formatHexStream("");
|
| @@ -144,6 +159,32 @@ var packagePtrResponse = <int>[
|
| 0x78, 0x00, 0x04, 0xa9, 0xfe, 0xa7, 0xac
|
| ];
|
|
|
| +var ptrRData = <int>[
|
| + 0x27, 0x73, 0x67, 0x6a, 0x65, 0x73, 0x73, 0x65,
|
| + 0x2d, 0x6d, 0x61, 0x63, 0x62, 0x6f, 0x6f, 0x6b,
|
| + 0x70, 0x72, 0x6f, 0x32, 0x20, 0x5b, 0x37, 0x38,
|
| + 0x3a, 0x33, 0x31, 0x3a, 0x63, 0x31, 0x3a, 0x62,
|
| + 0x38, 0x3a, 0x35, 0x35, 0x3a, 0x33, 0x38, 0x5d,
|
| + 0x0c, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x74,
|
| + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x04, 0x5f, 0x74,
|
| + 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
|
| + 0x00
|
| +];
|
| +
|
| +var ptrRData2 = <int>[
|
| + 0x0c, 0x66, 0x6c, 0x65, 0x74, 0x63, 0x68, 0x2d,
|
| + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x0d, 0x5f, 0x66,
|
| + 0x6c, 0x65, 0x74, 0x63, 0x68, 0x5f, 0x61, 0x67,
|
| + 0x65, 0x6e, 0x74, 0x04, 0x5f, 0x74, 0x63, 0x70,
|
| + 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00
|
| +];
|
| +
|
| +var srvRData = <int> [
|
| + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x59, 0x06, 0x66,
|
| + 0x6c, 0x65, 0x74, 0x63, 0x68, 0x05, 0x6c, 0x6f,
|
| + 0x63, 0x61, 0x6c, 0x00
|
| +];
|
| +
|
| // Support code to generate the hex-lists above from
|
| // a hex-stream.
|
| void formatHexStream(String hexStream) {
|
|
|