blob: 5c6255d65f4227eb868573c1cff0b3efe7e4f138 [file] [log] [blame]
/*
* Copyright (c) 2013, 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 E singleWhere(bool test(E element))
* Returns the single element that satisfies [test].
* @description Checks that the single element satisfying [test]
* is returned.
* @author msyabro
*/
import "dart:typed_data";
import "../../../Utils/expect.dart";
main() {
var l = new Float64List.fromList([0.0,0.0,0.0,0.0,0.0,5.0,0.0,0.0,-10.0,0.0]);
var res = l.singleWhere( (e) => e > 0 );
Expect.equals(5.0, res);
res = l.singleWhere( (e) => e < 0 );
Expect.equals(-10.0, res);
}