File tree Expand file tree Collapse file tree 2 files changed +32
-34
lines changed Expand file tree Collapse file tree 2 files changed +32
-34
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
import { assertArrayIncludes } from "@std/assert/array-includes" ;
4
4
import { translate } from "./translator.ts" ;
5
+ import { assert } from "@std/assert/assert" ;
6
+ import { number } from "./number.ts" ;
5
7
6
8
Deno . test ( "verb with adverb" , ( ) => {
7
9
const translations = translate ( "mi toki pona" ) . unwrap ( ) ;
8
10
assertArrayIncludes ( translations , [ "I nicely communicate" ] ) ;
9
11
} ) ;
12
+
13
+ const NUMBER_TESTS = new Map ( Object . entries ( {
14
+ "tu tu tu wan" : 7 ,
15
+ "luka tu" : 7 ,
16
+ "mute mute mute luka luka luka tu wan" : 78 ,
17
+ "wan" : 1 ,
18
+ "tu" : 2 ,
19
+ "tu wan" : 3 ,
20
+ "tu tu" : 4 ,
21
+ "luka" : 5 ,
22
+ "tu tu wan" : 5 ,
23
+ "luka wan" : 6 ,
24
+ "mute" : 20 ,
25
+ "luka luka luka luka" : 20 ,
26
+ "mute luka luka luka wan" : 36 ,
27
+ "ale" : 100 ,
28
+ "mute mute mute mute mute" : 100 ,
29
+ "ale ale ale" : 300 ,
30
+ "wan ale" : 100 ,
31
+ "tu wan ale" : 300 ,
32
+ "luka luka ale" : 1000 ,
33
+ "wan ale ale" : 10000 ,
34
+ "mute ale mute tu tu" : 2024 ,
35
+ } ) ) ;
36
+ Deno . test ( "numeral translation" , ( ) => {
37
+ for ( const [ tokiPona , expected ] of NUMBER_TESTS ) {
38
+ const numbers = number ( tokiPona . trim ( ) . split ( " " ) ) . unwrap ( ) ;
39
+ assert ( numbers . includes ( expected ) , `Error at "${ tokiPona } "` ) ;
40
+ }
41
+ } ) ;
You can’t perform that action at this time.
0 commit comments