aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-15 21:52:57 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-15 21:52:57 +0200
commit8e179a43e909ce4683f753a90bb3505630f05ad8 (patch)
tree5e46594af33ba7f82d1bd5ea954b99b4a92d0093 /test
parent3dc9484fc81db8f3c8ffd4ebb4bab042e66c6214 (diff)
implement alternate writings (failing tests down to 500)
Diffstat (limited to 'test')
-rw-r--r--test/base.ts8
-rw-r--r--test/deinflection/test.ts6
-rw-r--r--test/reading/test.ts7
3 files changed, 15 insertions, 6 deletions
diff --git a/test/base.ts b/test/base.ts
index 79c39ce..8369bfe 100644
--- a/test/base.ts
+++ b/test/base.ts
@@ -2,9 +2,17 @@ export { assertEquals } from "https://deno.land/std@0.193.0/testing/asserts.ts";
import Yomikun from "../api/yomikun.ts";
import DirectCoreClient from '../core/direct/client.ts';
+import { Wrap } from "../util/wrap.ts";
export const core = new DirectCoreClient();
export const api = new Yomikun(core);
await api.ready;
+export function formatCaseIndex(i: number, total: number) {
+ let out = "";
+ out += (i+1).toString().padStart(Math.log10(total) + 1, '0');
+ out += "/";
+ out += total.toString();
+ return out.wrap(Wrap.parenthesis);
+}
diff --git a/test/deinflection/test.ts b/test/deinflection/test.ts
index fac757e..0dfcdf9 100644
--- a/test/deinflection/test.ts
+++ b/test/deinflection/test.ts
@@ -1,10 +1,10 @@
import cases from "./cases.ts";
-import { core } from '../base.ts';
+import { core, formatCaseIndex } from '../base.ts';
import { Tag, TokenTag } from "../../search/tags.ts";
import { recursiveValues } from "../../util/object.ts";
-cases.forEach(({ input, mustHave, mustNotHave, force }) => {
- Deno.test(`deinflection - ${input}`, async () => {
+cases.forEach(({ input, mustHave, mustNotHave, force }, i) => {
+ Deno.test(`Deinflection ${formatCaseIndex(i, cases.length)} - ${input}`, async () => {
var terms = await core.search.terms(input);
if (terms.length == 0)
diff --git a/test/reading/test.ts b/test/reading/test.ts
index a2524de..c1e7de4 100644
--- a/test/reading/test.ts
+++ b/test/reading/test.ts
@@ -1,8 +1,9 @@
-import { api, assertEquals } from "../base.ts";
+import { api, assertEquals, formatCaseIndex } from "../base.ts";
import cases from "./cases.ts";
-cases.forEach(({input, output}) => {
- Deno.test(`Sentence reading - ${input}`, async () => {
+cases.forEach(({input, output}, i) => {
+ // if (i != 1) return;
+ Deno.test(`Sentence reading ${formatCaseIndex(i, cases.length)} - ${input}`, async () => {
// TODO: use sentence reading and tags
var sentence = await api.sentence(input);
assertEquals(sentence.furigana("refold-tools"), output);