-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.dart
50 lines (43 loc) · 1.05 KB
/
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
import 'dart:io';
import 'package:unscrambler/unscrambler.dart';
import 'package:test/test.dart';
void main() {
final C = new File('bin/sowpods.txt').readAsStringSync(),
D = new Dictionary(C);
test('', () {
const expectedMatches = const <String>[
'no',
'nox',
'noy',
'ny',
'on',
'ony',
'onyx',
'ox',
'oxy',
'oy',
'yo',
'yon',
'zo',
'zzz'
],
expectedAnagrams = const <String>[
'batlets',
'battels',
'battles',
'blatest',
'tablets'
];
final allMatches = D.match('zyxonzz', 0),
allMatches2 = D.match('zyxonzz', 1),
allMatches3 = D.match('zyxonzz', 2),
allMatches4 = D.anagrams('battles', 0);
expect(allMatches.length, 14);
allMatches
.forEach((bin) => expect(expectedMatches.contains(bin.word), true));
expect(allMatches2.length, 192);
expect(allMatches3.length, 1452);
allMatches4.forEach(
(WordBinary W) => expect(expectedAnagrams.contains(W.word), true));
});
}