-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathquiver_test.dart
72 lines (62 loc) · 1.71 KB
/
quiver_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2020, 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.
import 'package:test/test.dart';
import 'package:dartdoc/src/quiver.dart';
void main() {
group('concat', () {
test('should handle empty input iterables', () {
expect(concat([]), isEmpty);
});
test('should handle single input iterables', () {
expect(
concat([
[1, 2, 3]
]),
[1, 2, 3]);
});
test('should chain multiple input iterables', () {
expect(
concat([
[1, 2, 3],
[-1, -2, -3]
]),
[1, 2, 3, -1, -2, -3]);
});
test('should throw for null input', () {
expect(() => concat(null), throwsNoSuchMethodError);
});
test('should throw if any input is null', () {
expect(
() => concat([
[1, 2],
null,
[3, 4]
]).toList(),
throwsNoSuchMethodError);
});
test('should reflectchanges in the inputs', () {
var a = [1, 2];
var b = [4, 5];
var ab = concat([a, b]);
expect(ab, [1, 2, 4, 5]);
a.add(3);
b.add(6);
expect(ab, [1, 2, 3, 4, 5, 6]);
});
});
group('hash', () {
test('hash2 should return an int', () {
var h = hash2('123', 456);
expect(h, isA<int>());
});
test('hash3 should return an int', () {
var h = hash3('123', 456, true);
expect(h, isA<int>());
});
test('hash4 should return an int', () {
var h = hash4('123', 456, true, []);
expect(h, isA<int>());
});
});
}