pashto-inflector/src/lib/misc-helpers.test.ts

50 lines
2.9 KiB
TypeScript
Raw Normal View History

/**
* Copyright (c) 2021 lingdocs.com
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {
parseEc,
2021-07-13 22:10:58 +00:00
personFromVerbBlockPos,
} from "./misc-helpers";
2021-07-13 22:10:58 +00:00
import * as T from "../types";
test("personFromVerbBlockPos should work", () => {
expect(personFromVerbBlockPos([0, 0])).toEqual(T.Person.FirstSingMale);
expect(personFromVerbBlockPos([1, 0])).toEqual(T.Person.FirstSingFemale);
expect(personFromVerbBlockPos([2, 0])).toEqual(T.Person.SecondSingMale);
expect(personFromVerbBlockPos([3, 0])).toEqual(T.Person.SecondSingFemale);
expect(personFromVerbBlockPos([4, 0])).toEqual(T.Person.ThirdSingMale);
expect(personFromVerbBlockPos([5, 0])).toEqual(T.Person.ThirdSingFemale);
expect(personFromVerbBlockPos([0, 1])).toEqual(T.Person.FirstPlurMale);
expect(personFromVerbBlockPos([1, 1])).toEqual(T.Person.FirstPlurFemale);
expect(personFromVerbBlockPos([2, 1])).toEqual(T.Person.SecondPlurMale);
expect(personFromVerbBlockPos([3, 1])).toEqual(T.Person.SecondPlurFemale);
expect(personFromVerbBlockPos([4, 1])).toEqual(T.Person.ThirdPlurMale);
expect(personFromVerbBlockPos([5, 1])).toEqual(T.Person.ThirdPlurFemale);
})
test("parseEc should work", () => {
expect(parseEc("walk")).toEqual(["walk", "walks", "walking", "walked", "walked"]);
expect(parseEc("scare")).toEqual(["scare", "scares", "scaring", "scared", "scared"]);
expect(parseEc("study")).toEqual(["study","studies","studying","studied","studied"]);
2021-07-07 11:27:04 +00:00
expect(parseEc("cry")).toEqual(["cry", "cries", "crying", "cried", "cried"]);
2021-07-07 12:37:42 +00:00
expect(parseEc("marry")).toEqual(["marry","marries","marrying","married","married"]);
expect(parseEc("get")).toEqual(["get","gets","getting","got","gotten"]);
expect(parseEc("become")).toEqual(["become","becomes","becoming","became","become"]);
2021-07-08 11:35:02 +00:00
expect(parseEc("be")).toEqual(["am","is","being","was","been"]);
2021-07-07 12:37:42 +00:00
expect(parseEc("make")).toEqual(["make","makes","making","made","made"]);
expect(parseEc("have")).toEqual(["have","has","having","had","had"]);
2021-07-07 11:27:04 +00:00
expect(parseEc("die")).toEqual(["die", "dies", "dying", "died", "died"]);
2021-07-07 12:37:42 +00:00
expect(parseEc("stray")).toEqual(["stray","strays","straying","strayed","strayed"]);
expect(parseEc("cross")).toEqual(["cross","crosses","crossing","crossed","crossed"]);
2021-07-07 13:01:55 +00:00
expect(parseEc("raise")).toEqual(["raise","raises","raising","raised","raised"]);
2021-07-05 15:39:20 +00:00
expect(parseEc("play")).toEqual(["play","plays","playing","played","played"]);
2021-07-07 11:27:04 +00:00
// if there are only four items the perfect will be the same as the simple past
expect(parseEc("think,thinks,thinking,thought")).toEqual(["think","thinks","thinking","thought","thought"]);
expect(parseEc("sew,sews,sewing,sewed,sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
expect(parseEc(" sew, sews,sewing ,sewed, sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
});