blob: 51feca51fbb5eb2e6582b6f09adc34f9360ddf21 [file] [log] [blame]
/*
* 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.
*/
/**
* @assertion bool isBroadcast
* Whether this stream is a broadcast stream.
*
* @description Checks the property isBroadcast.
* @author ngl@unipro.ru
*/
import "dart:io";
import "dart:async";
import "../../../Utils/expect.dart";
check(InternetAddress address) {
asyncStart();
RawDatagramSocket.bind(address, 0).then((socket) {
Expect.equals(false, socket.isBroadcast);
Expect.equals(true, socket.asBroadcastStream().isBroadcast);
socket.close();
asyncEnd();
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}