Debian Codegraph @

t/numbers.t

raw
1 #!perl
2 use strict;
3 use warnings;
4 use Test::More;
5 use Test::NoWarnings ();
6 use lib 't/lib';
7 use TestPhrase 'test_phrase';
8
9 # number noun
10 test_phrase '0 eggs', '0 eggs';
11 test_phrase '1 egg', '1 egg';
12 test_phrase '2 eggs', '2 eggs';
13 test_phrase '1.5 joules', '1.5 joules';
14 test_phrase '2.4E4 electron-volts', '2.4E4 electron-volts';
15
16 # all other combinations with numbers
17 test_phrase '1 email from', '1 email from';
18 test_phrase '2 emails from', '2 emails from';
19 test_phrase '1 mother in law', '1 mother in law';
20 test_phrase '2 mothers in law', '2 mothers in law';
21 test_phrase '1 book binding', '1 book binding';
22 test_phrase '2 book bindings', '2 book bindings';
23 test_phrase '1 book book', '1 book book';
24 test_phrase '2 book books', '2 book books';
25 test_phrase '1 station visited', '1 station visited';
26 test_phrase '2 stations visited', '2 stations visited';
27 test_phrase '1 swedish fish', '1 swedish fish';
28 test_phrase '2 swedish fish', '2 swedish fish';
29 test_phrase '1 green', '1 green';
30 test_phrase '2 greens', '2 greens';
31
32 # ASCII fractions
33 test_phrase '1 1/2 joules', '1 1/2 joules';
34 test_phrase '1 and 1/2 joules', '1 and 1/2 joules';
35 test_phrase '1 and a half joules', '1 and a half joules';
36 test_phrase '1 and one half joules', '1 and one half joules';
37 test_phrase 'one and one half joules', 'one and one half joules';
38
39 # TODO Unicode fractions
40
41 # numbers as words
42
43 test_phrase 'zero eggs', 'zero eggs';
44 test_phrase 'one egg', 'one egg';
45 test_phrase 'the one egg', 'the one egg';
46 test_phrase 'two eggs', 'two eggs';
47 test_phrase 'the two eggs', 'the two eggs';
48 test_phrase 'the twenty two eggs', 'the twenty two eggs';
49 test_phrase 'one email from', 'one email from';
50 test_phrase 'the one email from', 'the one email from';
51 test_phrase 'two emails from', 'two emails from';
52 test_phrase 'one mother in law', 'one mother in law';
53 test_phrase 'the one mother in law', 'the one mother in law';
54 test_phrase 'two mothers in law', 'two mothers in law';
55 test_phrase 'one book binding', 'one book binding';
56 test_phrase 'the one book binding', 'the one book binding';
57 test_phrase 'two book bindings', 'two book bindings';
58 test_phrase 'one book book', 'one book book';
59 test_phrase 'the one book book', 'the one book book';
60 test_phrase 'two book books', 'two book books';
61 test_phrase 'one station visited', 'one station visited';
62 test_phrase 'the one station visited', 'the one station visited';
63 test_phrase 'two stations visited', 'two stations visited';
64 test_phrase 'one swedish fish', 'one swedish fish';
65 test_phrase 'the one swedish fish', 'the one swedish fish';
66 test_phrase 'two swedish fish', 'two swedish fish';
67 test_phrase 'one green', 'one green';
68 test_phrase 'the one green', 'the one green';
69 test_phrase 'two greens', 'two greens';
70
71 # numbers by themselves
72
73 test_phrase 'the 1', 'the 1s';
74 test_phrase 'the 2', 'the 2s';
75 test_phrase '1', '1s';
76 test_phrase '2', '2s';
77 test_phrase 'the one', 'the ones';
78 test_phrase 'the two', 'the twos';
79 test_phrase 'one', 'ones';
80 test_phrase 'two', 'twos';
81
82 # ordinal numbers
83
84 test_phrase '1st release', '1st releases';
85 test_phrase 'first release', 'first releases';
86 test_phrase 'second trip', 'second trips';
87 test_phrase 'twenty third egg', 'twenty third eggs';
88 test_phrase '2nd car', '2nd cars';
89
90 Test::NoWarnings::had_no_warnings;
91
92 done_testing;