aboutsummaryrefslogtreecommitdiff
path: root/test/reading/test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/reading/test.ts')
-rw-r--r--test/reading/test.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/reading/test.ts b/test/reading/test.ts
new file mode 100644
index 0000000..9d426d4
--- /dev/null
+++ b/test/reading/test.ts
@@ -0,0 +1,32 @@
+import * as path from 'https://deno.land/std@0.102.0/path/mod.ts';
+Deno.chdir(path.dirname(path.fromFileUrl(Deno.mainModule)) + "/../..");
+
+import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts";
+
+import YomikunDirectAPIClient from "../../core/direct/client.ts";
+
+var api = new YomikunDirectAPIClient();
+await api.prepare();
+
+interface Test {
+ test: {
+ input: string;
+ reading: string;
+ };
+ _original: string;
+ tags: Array<string>;
+};
+
+const tests = JSON.parse(await Deno.readTextFile(path.resolve('test', 'reading', 'cases.json'))) as Test[];
+
+console.log(`amount of sentences: ${tests.length}`);
+console.log(`average sentence length: ${tests.map(t => t.test.input.length).reduce((a, b) => a + b) / tests.length}`);
+
+console.time("parse");
+for (var { test } of tests) {
+ var result = await api.parseSentence(test.input);
+ // TODO: add reading back into conjugated verb to complete this test
+
+}
+console.timeEnd("parse");
+