| // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| // @dart = 2.9 |
| |
| /// @assertion List<int> rawAddress |
| /// Get the raw address of this [InternetAddress]. |
| /// @description Checks that result list for IPv6 localhost is 16 byte long and |
| /// contains expected values (all zeroes but the last value which 0s [1]). |
| /// @author iarkh@unipro.ru |
| |
| |
| import "../../../Utils/expect.dart"; |
| import "dart:io"; |
| |
| check(List expected, List actual) { |
| Expect.equals(expected.length, actual.length); |
| int i = 0; |
| actual.forEach((var element) { |
| Expect.equals(expected[i++], element); |
| }); |
| } |
| |
| main() { |
| List expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; |
| InternetAddress address = new InternetAddress("::1"); |
| check(expected, address.rawAddress); |
| } |