From 30d26ae693265c09f24bbde3ba6a412885ada204 Mon Sep 17 00:00:00 2001 From: Arun Prasad Date: Mon, 6 Nov 2023 18:46:56 -0800 Subject: [PATCH] [prakriya] Explicitly model unadi-pratyayas - Separate common krt-pratyayas and unadi-pratyayas into their own enums. - Standardize most test functions and avoid tests like `lat_p` and `lat_a`. --- vidyut-prakriya/src/args.rs | 2 + vidyut-prakriya/src/args/krt.rs | 167 +--- vidyut-prakriya/src/args/unadi.rs | 942 ++++++++++++++++++++ vidyut-prakriya/src/ashtadhyayi.rs | 55 +- vidyut-prakriya/src/bin/create_krdantas.rs | 4 +- vidyut-prakriya/src/bin/test_krdantas.rs | 4 +- vidyut-prakriya/src/it_samjna.rs | 4 +- vidyut-prakriya/src/krt/basic.rs | 38 +- vidyut-prakriya/src/krt/unadi_sutras.rs | 377 +++++--- vidyut-prakriya/src/krt/utils.rs | 59 +- vidyut-prakriya/src/prakriya.rs | 7 +- vidyut-prakriya/src/prakriya_stack.rs | 23 +- vidyut-prakriya/src/tag.rs | 1 + vidyut-prakriya/src/term.rs | 5 + vidyut-prakriya/src/wasm.rs | 4 +- vidyut-prakriya/test_utils/src/lib.rs | 976 ++++++++++----------- vidyut-prakriya/tests/api.rs | 11 +- vidyut-prakriya/tests/basic_krdantas.rs | 5 +- vidyut-prakriya/tests/kashika_1_1.rs | 70 +- vidyut-prakriya/tests/kashika_1_2.rs | 96 +- vidyut-prakriya/tests/kashika_1_3.rs | 21 +- vidyut-prakriya/tests/kashika_1_4.rs | 17 +- vidyut-prakriya/tests/kashika_2_4.rs | 43 +- vidyut-prakriya/tests/kashika_3_1.rs | 234 ++--- vidyut-prakriya/tests/kashika_3_2.rs | 17 +- vidyut-prakriya/tests/kashika_3_3.rs | 36 +- vidyut-prakriya/tests/kashika_3_4.rs | 25 +- vidyut-prakriya/tests/kashika_4_4.rs | 13 + vidyut-prakriya/tests/kashika_6_1.rs | 188 ++-- vidyut-prakriya/tests/kashika_6_3.rs | 2 +- vidyut-prakriya/tests/kashika_6_4.rs | 200 +++-- vidyut-prakriya/tests/kashika_7_1.rs | 59 +- vidyut-prakriya/tests/kashika_7_2.rs | 277 +++--- vidyut-prakriya/tests/kashika_7_3.rs | 198 +++-- vidyut-prakriya/tests/kashika_7_4.rs | 376 ++++---- vidyut-prakriya/tests/kashika_8_2.rs | 55 +- vidyut-prakriya/tests/kashika_8_3.rs | 150 ++-- vidyut-prakriya/tests/kashika_8_4.rs | 176 ++-- vidyut-prakriya/tests/kaumudi_43.rs | 8 +- vidyut-prakriya/tests/kaumudi_46.rs | 7 +- vidyut-prakriya/tests/kaumudi_48.rs | 2 +- vidyut-prakriya/tests/kaumudi_52.rs | 8 +- vidyut-prakriya/tests/kaumudi_65.rs | 6 +- vidyut-prakriya/tests/kaumudi_67.rs | 237 ++--- 44 files changed, 3242 insertions(+), 1963 deletions(-) create mode 100644 vidyut-prakriya/src/args/unadi.rs diff --git a/vidyut-prakriya/src/args.rs b/vidyut-prakriya/src/args.rs index 7340783..27cb204 100644 --- a/vidyut-prakriya/src/args.rs +++ b/vidyut-prakriya/src/args.rs @@ -16,12 +16,14 @@ mod krt; mod sup; mod taddhita; mod tin; +mod unadi; pub use dhatu::*; pub use krt::*; pub use sup::*; pub use taddhita::*; pub use tin::*; +pub use unadi::Unadi; /// Models a semantic condition that applies to the prakriya. #[derive(Copy, Clone, Debug, Eq, PartialEq)] diff --git a/vidyut-prakriya/src/args/krt.rs b/vidyut-prakriya/src/args/krt.rs index a378ee2..d7245b3 100644 --- a/vidyut-prakriya/src/args/krt.rs +++ b/vidyut-prakriya/src/args/krt.rs @@ -1,8 +1,9 @@ +use crate::args::unadi::Unadi; use crate::enum_boilerplate; use crate::errors::*; use wasm_bindgen::prelude::wasm_bindgen; -/// The complete list of krt-pratyayas. +/// The complete list of ordinary krt-pratyayas. /// /// Rust's naming convention is to start enum values with capital letters. However, we allow mixed /// case explicitly here so that we can name pratyayas more concisely with SLP1. Doing so helps us @@ -10,7 +11,7 @@ use wasm_bindgen::prelude::wasm_bindgen; #[allow(dead_code, non_camel_case_types)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] #[wasm_bindgen] -pub enum Krt { +pub enum BaseKrt { /// -a a, /// -a @@ -125,8 +126,6 @@ pub enum Krt { Nvanip, /// -Ana cAnaS, - /// -anta, - Jac, /// -a wa, /// -a @@ -209,82 +208,9 @@ pub enum Krt { zwran, /// -aka zvun, - - // unAdi-pratyayas - // =============== - /// -ama (praTama) - amac, - /// -ala (maNgala) - alac, - /// -as (cetaH) - asun, - /// -Ayya - Ayya, - /// -itnu - itnuc, - /// -iTi - iTin, - /// -iza - wizac, - /// -izWu - izWuc, - /// -izWa - izWac, - /// -isa - isan, - /// -is - isi, - /// -u (kAru) - uR, - /// -us (Danus) - usi, - /// -atu (kratu) - katu, - /// -ka - kan, - /// -Ta - kTan, - /// -vi (jAgfvi) - kvinUnadi, - /// -sara - ksaran, - /// -si - ksi, - /// -su - ksu, - /// -u (tAlu) - YuR, - /// -ta - tan, - /// -tu - tun, - /// -tra, - tran, - /// -sa - sa, - /// -sara - sara, - /// -su - suk, - /// -atni, - katnic, - /// -yatu, - yatuc, - /// -ali - alic, - /// -sya - syan, - /// -uli - uli, - /// -as (use trailing `_` since `as` is a reserved keyword in Rust.) - asa, - /// -As, - Asa, - /// -Anu - Anuk, } -enum_boilerplate!(Krt, { +enum_boilerplate!(BaseKrt, { a => "a", ac => "ac", aR => "aR", @@ -383,51 +309,32 @@ enum_boilerplate!(Krt, { zAkan => "zAkan", zwran => "zwran", zvun => "zvu~n", - - // unAdi-pratyayas - // =============== - amac => "amac", - alac => "alac", - asun => "asu~n", - Ayya => "Ayya", - itnuc => "itnuc", - iTin => "iTin", - izWuc => "izWuc", - izWac => "izWac", - isan => "isan", - isi => "isi~", - uR => "uR", - usi => "usi~", - // TODO: why do we keep the initial 'k' here? - kan => "a~kan", - katu => "katu", - kTan => "kTan", - kvinUnadi => "kvin", - ksaran => "ksaran", - ksi => "ksi", - ksu => "ksu", - Jac => "Jac", - YuR => "YuR", - wizac => "wizac", - tan => "tan", - tun => "tun", - tran => "tran", - sa => "sa", - sara => "sara", - suk => "suk", - katnic => "katnic", - yatuc => "yatuc", - alic => "alic", - syan => "syan", - uli => "uli", - asa => "asa", - Asa => "Asa", - Anuk => "Anuk", }); +/// Models a krt-pratyaya. +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] +pub enum Krt { + /// An ordinary krt-pratyaya as declared in the Ashtadhyayi. + Base(BaseKrt), + /// An unadi-pratyaya as declared in the Unadipatha. + Unadi(Unadi), +} + +impl From for Krt { + fn from(base: BaseKrt) -> Krt { + Krt::Base(base) + } +} + +impl From for Krt { + fn from(unadi: Unadi) -> Krt { + Krt::Unadi(unadi) + } +} + /// Models the meaning of a krt-pratyaya. /// -/// krts are often available only in specific senses. A given krta might be allowed in one sense +/// krts are often available only in specific senses. A given krt might be allowed in one sense /// but blocked in another. To model and test this behavior, we use the enum below. #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] pub enum KrtArtha { @@ -451,8 +358,22 @@ impl Krt { /// We must track this explicitly so that we can "look ahead" and potentially add -Aya or other /// pratyayas for certain dhAtus. For details, see the implementation of rules 3.1.28 - 3.1.31. pub fn is_ardhadhatuka(&self) -> bool { - use Krt::*; - !matches!(self, Sa | Satf | SAnac | SAnan | cAnaS | KaS) + use BaseKrt::*; + match self { + Krt::Base(k) => !matches!(k, Sa | Satf | SAnac | SAnan | cAnaS | KaS), + Krt::Unadi(_) => true, + } + } + + /// Returns a simple human-readable string that represents this enum's value. + /// + /// This mapping is not reversible. This is because some pratyayas are in both `Base` and + /// `Unadi`. + pub fn as_str(&self) -> &'static str { + match self { + Krt::Base(b) => b.as_str(), + Krt::Unadi(u) => u.as_str(), + } } } @@ -532,8 +453,8 @@ pub struct KrdantaArgsBuilder { impl KrdantaArgsBuilder { /// Sets the krt-pratyaya to use in the derivation. - pub fn krt(&mut self, val: Krt) -> &mut Self { - self.krt = Some(val); + pub fn krt(&mut self, val: impl Into) -> &mut Self { + self.krt = Some(val.into()); self } diff --git a/vidyut-prakriya/src/args/unadi.rs b/vidyut-prakriya/src/args/unadi.rs new file mode 100644 index 0000000..3955ae0 --- /dev/null +++ b/vidyut-prakriya/src/args/unadi.rs @@ -0,0 +1,942 @@ +use crate::enum_boilerplate; +use crate::errors::*; + +use wasm_bindgen::prelude::wasm_bindgen; + +/// The complete list of unadi-pratyayas. +/// +/// Rust's naming convention is to start enum values with capital letters. However, we allow mixed +/// case explicitly here so that we can name pratyayas more concisely with SLP1. Doing so helps us +/// distinguish between pratyayas like `naN` and `nan`. +/// +/// NOTE: we generated this list programmatically. Many of these pratyayas have typos. +#[allow(dead_code, non_camel_case_types)] +#[allow(dead_code, non_camel_case_types)] +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] +#[wasm_bindgen] +pub enum Unadi { + /// -aknu + aknuc, + /// -aNga + aNgac, + /// -a + ac, + /// -aji + aji, + /// -awa + awan, + /// -awi + awi, + /// -aWa + aWa, + /// -aRqa + aRqan, + /// -ata + atac, + /// -ati + ati, + /// -atra + atran, + /// -atri + atrin, + /// -aTa + aTa, + /// -adi + adi, + /// -a + an, + /// -ani + ani, + /// -anu + anuN, + /// -anya + anya, + /// -anyu + anyuc, + /// -apa + apa, + /// -abaka + abaka, + /// -aba + abac, + /// -aBa + aBac, + /// -ama + ama, + /// -ama (praTama) + amac, + /// -amba + ambaj, + /// -ayu + ayu, + /// -ara + ara, + /// -ara + aran, + /// -aru + aru, + /// -a + al, + /// -ala (maNgala) + alac, + /// -ali + alic, + /// -avi + avi, + /// -a + asa, + /// -asa + asac, + /// -asAna + asAnac, + /// -asi + asi, + /// -as (cetas) + asun, + /// -A + A, + /// -Aka + Aka, + /// -AgU + AgUc, + /// -Awa + Awac, + /// -ARaka + ARaka, + /// -Atu + Atu, + /// -Atfka + Atfkan, + /// -Anaka + Anaka, + /// -Ana + Anac, + /// -Anu + Anuk, + /// -Anya + Anya, + /// -Ayya + Ayya, + /// -Ara + Aran, + /// -Ala + Ala, + /// -Ala + Alac, + /// -Ala + AlaY, + /// -AlIya + AlIyac, + /// -A + Asa, + /// -Asi + Asi, + /// -i + i, + /// -ika + ikan, + /// -iji + iji, + /// -i + iY, + /// -i + iR, + /// -ita + ita, + /// -ita + itac, + /// -ita + itan, + /// -iti + iti, + /// -itnu + itnuc, + /// -itra + itra, + /// -itva + itvan, + /// -iTi + iTin, + /// -i + in_, + /// -ina + inac, + /// -ina + inaR, + /// -ina + inan, + /// -in + ini, + /// -imani + imanic, + /// -imani + imanin, + /// -ila + ilac, + /// -izWa + izWac, + /// -izWu + izWuc, + /// -izRu + izRuc, + /// -isa + isan, + /// -is + isi, + /// -is + isin, + /// -I + I, + /// -Ika + Ikan, + /// -Ici + Ici, + /// -Ida + Ida, + /// -Ira + Irac, + /// -Ira + Iran, + /// -Iza + Izan, + /// -u + u, + /// -uka + ukan, + /// -uqa + uqac, + /// -u + uR, + /// -uti + uti, + /// -utra + utra, + /// -una + una, + /// -una + unan, + /// -unasi + unasi, + /// -uni + uni, + /// -unta + unta, + /// -unti + unti, + /// -uma + uma, + /// -umBa + umBa, + /// -ura + urac, + /// -ura + uran, + /// -uri + urin, + /// -ula + ulac, + /// -uli + uli, + /// -uza + uzac, + /// -us (Danus) + usi, + /// -U + U, + /// -Uka + Uka, + /// -Uka + UkaR, + /// -UKa + UKa, + /// -UTa + UTan, + /// -Uma + Uma, + /// -U + Ur, + /// -Ura + Uran, + /// -Uza + Uzan, + /// -f + f, + /// -fti + ftin, + /// -f + fn_, + /// -eRu + eRu, + /// -eRya + eRya, + /// -era + erak, + /// -elima + elimac, + /// -ota + otac, + /// -ora + oran, + /// -ola + olac, + /// -ka + ka, + /// -ka + kak, + /// -kaNkaRa + kaNkaRa, + /// -kaRa + kaRa, + /// -katu + katu, + /// -katni + katnic, + /// -katra + katra, + /// -kTa + kTan, + /// -ka + kan, + /// -kanasi + kanasi, + /// -kani + kanin, + /// -kanu + kanum, + /// -kanya + kanyan, + /// -kanyu + kanyuc, + /// -kapa + kapa, + /// -kapa + kapan, + /// -kami + kamin, + /// -kaya + kayan, + /// -kara + karan, + /// -kala + kala, + /// -kAku + kAku, + /// -kAla + kAlan, + /// -kika + kikan, + /// -kita + kitac, + /// -kinda + kindac, + /// -kira + kirac, + /// -kizya + kizyan, + /// -kIka + kIkac, + /// -kIka + kIkan, + /// -kIwa + kIwan, + /// -ku + ku, + /// -ku + kuk, + /// -kuka + kukan, + /// -kuza + kuzan, + /// -kU + kU, + /// -kta + kta, + /// -ktnu + ktnu, + /// -ktra + ktra, + /// -kTi + kTin, + /// -kna + kna, + /// -kni + knin, + /// -kmala + kmalan, + /// -kyu + kyu, + /// -kyu + kyun, + /// -kra + kran, + /// -krara + kraran, + /// -kri + kri, + /// -kri + krin, + /// -kruka + krukan, + /// -kru + krun, + /// -kla + kla, + /// -kva + kvan, + /// -kvani + kvanip, + /// -kvi + kvin, + /// -kvi + kvip, + /// -kvu + kvun, + /// -ksara + ksaran, + /// -ksi + ksi, + /// -ksu + ksu, + /// -kseyya + kseyya, + /// -ksna + ksna, + /// -Ka + Ka, + /// -ga + ga, + /// -ga + gak, + /// -ga + gaR, + /// -ga + gan, + /// -GaTi + GaTin, + /// -ca + caw, + /// -catu + catu, + /// -ci + cik, + /// -Ja + Jac, + /// -Ji + Jic, + /// -Yu + YuR, + /// -wa + wa, + /// -wa + wan, + /// -wiza + wizac, + /// -Wa + Wa, + /// -qa + qa, + /// -qau + qau, + /// -qa + qaw, + /// -qati + qati, + /// -qavatu + qavatu, + /// -qimi + qimi, + /// -quta + qutac, + /// -qu + qun, + /// -qumsu + qumsun, + /// -qU + qU, + /// -qE + qE, + /// -qEsi + qEsi, + /// -qo + qo, + /// -qosi + qosi, + /// -qO + qO, + /// -qri + qri, + /// -Qa + Qa, + /// -Ritra + Ritran, + /// -Ru + Ru, + /// -Ruka + Rukan, + /// -ta + ta, + /// -taka + takan, + /// -ta + tan, + /// -tana + tanan, + /// -taSa + taSan, + /// -taSasu + taSasun, + /// -ti + ti, + /// -tika + tikan, + /// -tu + tu, + /// -tu + tun, + /// -tf + tfc, + /// -tf + tfn, + /// -tna + tnaR, + /// -tyu + tyuk, + /// -tra + tra, + /// -tra + tran, + /// -tri + trin, + /// -tri + trip, + /// -tva + tvan, + /// -Ta + Tak, + /// -da + da, + /// -da + dan, + /// -Du + Duk, + /// -na + na, + /// -na + nak, + /// -ni + ni, + /// -nu + nu, + /// -pa + pa, + /// -pAsa + pAsa, + /// -Pa + Pak, + /// -ba + ban, + /// -Ba + Ba, + /// -Ba + Ban, + /// -ma + mak, + /// -madi + madik, + /// -ma + man, + /// -man + mani, + /// -man + maniR, + /// -man + manin, + /// -mi + mi, + /// -mi + min, + /// -mu + muk, + /// -ya + ya, + /// -ya + yak, + /// -ya + yat, + /// -yatu + yatuc, + /// -yu + yuk, + /// -yu + yuc, + /// -yu + yun, + /// -ra + ra, + /// -ra + rak, + /// -ra + ran, + /// -ru + ru, + /// -la + lak, + /// -va + va, + /// -va + vaR, + /// -va + van, + /// -vani + vanip, + /// -vara + varaw, + /// -vala + valaY, + /// -vAla + vAlac, + /// -vAla + vAlan, + /// -vi + vin, + /// -vu + vun, + /// -Sa + Sak, + /// -Su + Sun, + /// -Sva + SvaR, + /// -ziva + zivan, + /// -zwra + zwran, + /// -zvara + zvarac, + /// -sa + sa, + /// -sa + san, + /// -sara + sara, + /// -sika + sikan, + /// -sTa + sTan, + /// -sma + sman, + /// -sya + sya, + /// -sya + syan, +} + +enum_boilerplate!(Unadi, { + aknuc => "aknuc", + aNgac => "aNgac", + ac => "ac", + aji => "aji", + awan => "awan", + awi => "awi", + aWa => "aWa", + aRqan => "aRqan", + atac => "atac", + ati => "ati", + atran => "atran", + atrin => "atrin", + aTa => "aTa", + adi => "adi", + an => "an", + ani => "ani", + anuN => "anuN", + anya => "anya", + anyuc => "anyuc", + apa => "apa", + abaka => "abaka", + abac => "abac", + aBac => "aBac", + ama => "ama", + amac => "amac", + ambaj => "ambaj", + ayu => "ayu", + ara => "ara", + aran => "aran", + aru => "aru", + al => "al", + alac => "alac", + alic => "alic", + avi => "avi", + asa => "asa", + asac => "asac", + asAnac => "asAnac", + asi => "asi", + asun => "asu~n", + A => "A", + Aka => "Aka", + AgUc => "AgUc", + Awac => "Awac", + ARaka => "ARaka", + Atu => "Atu", + Atfkan => "Atfkan", + Anaka => "Anaka", + Anac => "Anac", + Anuk => "Anuk", + Anya => "Anya", + Ayya => "Ayya", + Aran => "Aran", + Ala => "Ala", + Alac => "Alac", + AlaY => "AlaY", + AlIyac => "AlIyac", + Asa => "Asa", + Asi => "Asi", + i => "i", + ikan => "ikan", + iji => "iji", + iY => "iY", + iR => "iR", + ita => "ita", + itac => "itac", + itan => "itan", + iti => "iti", + itnuc => "itnuc", + itra => "itra", + itvan => "itvan", + iTin => "iTin", + in_ => "in", + inac => "inac", + inaR => "inaR", + inan => "inan", + ini => "ini~", + imanic => "imanic", + imanin => "imanin", + ilac => "ilac", + izWac => "izWac", + izWuc => "izWuc", + izRuc => "izRuc", + isan => "isan", + isi => "isi~", + isin => "isi~n", + I => "I", + Ikan => "Ikan", + Ici => "Ici", + Ida => "Ida", + Irac => "Irac", + Iran => "Iran", + Izan => "Izan", + u => "u", + ukan => "ukan", + uqac => "uqac", + uR => "uR", + uti => "uti", + utra => "utra", + una => "una", + unan => "unan", + unasi => "unasi", + uni => "uni", + unta => "unta", + unti => "unti", + uma => "uma", + umBa => "umBa", + urac => "urac", + uran => "uran", + urin => "urin", + ulac => "ulac", + uli => "uli", + uzac => "uzac", + usi => "usi~", + U => "U", + Uka => "Uka", + UkaR => "UkaR", + UKa => "UKa", + UTan => "UTan", + Uma => "Uma", + Ur => "Ur", + Uran => "Uran", + Uzan => "Uzan", + f => "f", + ftin => "ftin", + fn_ => "fn", + eRu => "eRu", + eRya => "eRya", + erak => "erak", + elimac => "elimac", + otac => "otac", + oran => "oran", + olac => "olac", + ka => "ka", + kak => "kak", + kaNkaRa => "kaNkaRa", + kaRa => "kaRa", + katu => "katu", + katnic => "katnic", + katra => "katra", + kTan => "kTan", + kan => "kan", + kanasi => "kanasi", + kanin => "kanin", + kanum => "kanum", + kanyan => "kanyan", + kanyuc => "kanyuc", + kapa => "kapa", + kapan => "kapan", + kamin => "kamin", + kayan => "kayan", + karan => "karan", + kala => "kala", + kAku => "kAku", + kAlan => "kAlan", + kikan => "kikan", + kitac => "kitac", + kindac => "kindac", + kirac => "kirac", + kizyan => "kizyan", + kIkac => "kIkac", + kIkan => "kIkan", + kIwan => "kIwan", + ku => "ku", + kuk => "kuk", + kukan => "kukan", + kuzan => "kuzan", + kU => "kU", + kta => "kta", + ktnu => "ktnu", + ktra => "ktra", + kTin => "kTin", + kna => "kna", + knin => "knin", + kmalan => "kmalan", + kyu => "kyu", + kyun => "kyun", + kran => "kran", + kraran => "kraran", + kri => "kri", + krin => "krin", + krukan => "krukan", + krun => "krun", + kla => "kla", + kvan => "kvan", + kvanip => "kvanip", + kvin => "kvin", + kvip => "kvip", + kvun => "kvun", + ksaran => "ksaran", + ksi => "ksi", + ksu => "ksu", + kseyya => "kseyya", + ksna => "ksna", + Ka => "Ka", + ga => "ga", + gak => "gak", + gaR => "gaR", + gan => "gan", + GaTin => "GaTin", + caw => "caw", + catu => "catu", + cik => "cik", + Jac => "Jac", + Jic => "Jic", + YuR => "YuR", + wa => "wa", + wan => "wan", + wizac => "wizac", + Wa => "Wa", + qa => "qa", + qau => "qau", + qaw => "qaw", + qati => "qati", + qavatu => "qavatu", + qimi => "qimi", + qutac => "qutac", + qun => "qun", + qumsun => "qumsun", + qU => "qU", + qE => "qE", + qEsi => "qEsi", + qo => "qo", + qosi => "qosi", + qO => "qO", + qri => "qri", + Qa => "Qa", + Ritran => "Ritran", + Ru => "Ru", + Rukan => "Rukan", + ta => "ta", + takan => "takan", + tan => "tan", + tanan => "tanan", + taSan => "taSan", + taSasun => "taSasun", + ti => "ti", + tikan => "tikan", + tu => "tu", + tun => "tun", + tfc => "tfc", + tfn => "tfn", + tnaR => "tnaR", + tyuk => "tyuk", + tra => "tra", + tran => "tran", + trin => "trin", + trip => "trip", + tvan => "tvan", + Tak => "Tak", + da => "da", + dan => "dan", + Duk => "Duk", + na => "na", + nak => "nak", + ni => "ni", + nu => "nu", + pa => "pa", + pAsa => "pAsa", + Pak => "Pak", + ban => "ban", + Ba => "Ba", + Ban => "Ban", + mak => "mak", + madik => "madik", + man => "man", + mani => "mani~", + maniR => "mani~R", + manin => "mani~n", + mi => "mi", + min => "min", + muk => "muk", + ya => "ya", + yak => "yak", + yat => "yat", + yatuc => "yatuc", + yuk => "yuk", + yuc => "yuc", + yun => "yun", + ra => "ra", + rak => "rak", + ran => "ran", + ru => "ru", + lak => "lak", + va => "va", + vaR => "vaR", + van => "van", + vanip => "vanip", + varaw => "varaw", + valaY => "valaY", + vAlac => "vAlac", + vAlan => "vAlan", + vin => "vin", + vun => "vun", + Sak => "Sak", + Sun => "Sun", + SvaR => "SvaR", + zivan => "zivan", + zwran => "zwran", + zvarac => "zvarac", + sa => "sa", + san => "san", + sara => "sara", + sikan => "sikan", + sTan => "sTan", + sman => "sman", + sya => "sya", + syan => "syan", +}); diff --git a/vidyut-prakriya/src/ashtadhyayi.rs b/vidyut-prakriya/src/ashtadhyayi.rs index 45f0c1d..85585ff 100644 --- a/vidyut-prakriya/src/ashtadhyayi.rs +++ b/vidyut-prakriya/src/ashtadhyayi.rs @@ -9,7 +9,7 @@ use crate::angasya; use crate::ardhadhatuka; use crate::args::Upapada; use crate::args::{ - Artha, Dhatu, KrdantaArgs, Krt, Lakara, Linga, Pratipadika, Prayoga, SubantaArgs, + Artha, BaseKrt, Dhatu, KrdantaArgs, Krt, Lakara, Linga, Pratipadika, Prayoga, SubantaArgs, TaddhitantaArgs, TinantaArgs, }; use crate::atidesha; @@ -79,17 +79,18 @@ fn add_lakara_and_decide_pada(p: &mut Prakriya, lakara: Lakara) { /// Certain krt-pratyayas are allowed only if they replace a specific lakara. To accommodate those /// rules, first run this check. fn maybe_add_lakara_for_krt(p: &mut Prakriya, krt: Krt) { - use Krt::*; - use Lakara::*; - - if matches!(krt, Satf | SAnac) { - // TODO: also support Lrt (gamizyat) and karmani. - p.add_tag(Tag::Kartari); - add_lakara_and_decide_pada(p, Lat); - } else if matches!(krt, kAnac | kvasu) { - // TODO: also support karmani. - p.add_tag(Tag::Kartari); - add_lakara_and_decide_pada(p, Lit); + if let Krt::Base(b) = krt { + use BaseKrt::*; + use Lakara::*; + if matches!(b, Satf | SAnac) { + // TODO: also support Lrt (gamizyat) and karmani. + p.add_tag(Tag::Kartari); + add_lakara_and_decide_pada(p, Lat); + } else if matches!(b, kAnac | kvasu) { + // TODO: also support karmani. + p.add_tag(Tag::Kartari); + add_lakara_and_decide_pada(p, Lit); + } } } @@ -372,7 +373,7 @@ pub struct Ashtadhyayi { // `Prakriya::step` private and add a check statement in `Prakriya::op`. log_steps: bool, // If set, also generate chaandasa forms. - is_chandasa: bool, + is_chandasi: bool, } // TODO: better error handling. @@ -381,7 +382,7 @@ impl Ashtadhyayi { pub fn new() -> Self { Ashtadhyayi { log_steps: true, - is_chandasa: false, + is_chandasi: false, } } @@ -413,9 +414,9 @@ impl Ashtadhyayi { /// # Ok::<(), Error>(()) /// ``` pub fn derive_tinantas(&self, dhatu: &Dhatu, args: &TinantaArgs) -> Vec { - let mut stack = PrakriyaStack::new(); + let mut stack = self.create_prakriya_stack(); // TODO: handle error properly. - stack.find_all(|p| derive_tinanta(p, dhatu, args), self.log_steps); + stack.find_all(|p| derive_tinanta(p, dhatu, args)); let mut prakriyas = stack.prakriyas(); // If the caller specified an explicit pada, keep only the results that match that pada. @@ -454,8 +455,8 @@ impl Ashtadhyayi { /// # Ok::<(), Error>(()) /// ``` pub fn derive_subantas(&self, pratipadika: &Pratipadika, args: &SubantaArgs) -> Vec { - let mut stack = PrakriyaStack::new(); - stack.find_all(|p| derive_subanta(p, pratipadika, args), self.log_steps); + let mut stack = self.create_prakriya_stack(); + stack.find_all(|p| derive_subanta(p, pratipadika, args)); stack.prakriyas() } @@ -478,8 +479,8 @@ impl Ashtadhyayi { /// # Ok::<(), Error>(()) /// ``` pub fn derive_krdantas(&self, dhatu: &Dhatu, args: &KrdantaArgs) -> Vec { - let mut stack = PrakriyaStack::new(); - stack.find_all(|p| derive_krdanta(p, dhatu, args), self.log_steps); + let mut stack = self.create_prakriya_stack(); + stack.find_all(|p| derive_krdanta(p, dhatu, args)); stack.prakriyas() } @@ -506,17 +507,21 @@ impl Ashtadhyayi { pratipadika: &Pratipadika, args: &TaddhitantaArgs, ) -> Vec { - let mut stack = PrakriyaStack::new(); - stack.find_all(|p| derive_taddhitanta(p, pratipadika, args), self.log_steps); + let mut stack = self.create_prakriya_stack(); + stack.find_all(|p| derive_taddhitanta(p, pratipadika, args)); stack.prakriyas() } /// Returns all possible sandhi results that follow from the given initial conditions. pub fn derive_vakyas(&self, first: impl AsRef, second: impl AsRef) -> Vec { - let mut stack = PrakriyaStack::new(); - stack.find_all(|p| derive_vakya(p, &first, &second), self.log_steps); + let mut stack = self.create_prakriya_stack(); + stack.find_all(|p| derive_vakya(p, &first, &second)); stack.prakriyas() } + + fn create_prakriya_stack(&self) -> PrakriyaStack { + PrakriyaStack::new(self.log_steps, self.is_chandasi) + } } /// A builder for creating an `Ashtadhyayi` struct. @@ -551,7 +556,7 @@ impl AshtadhyayiBuilder { /// /// - If `false`, each `Prakriya` will use a standard ruleset. pub fn is_chandasa(mut self, value: bool) -> Self { - self.a.is_chandasa = value; + self.a.is_chandasi = value; self } diff --git a/vidyut-prakriya/src/bin/create_krdantas.rs b/vidyut-prakriya/src/bin/create_krdantas.rs index 1a492f8..fd5d3ab 100644 --- a/vidyut-prakriya/src/bin/create_krdantas.rs +++ b/vidyut-prakriya/src/bin/create_krdantas.rs @@ -6,14 +6,14 @@ use clap::Parser; use serde::Serialize; use std::error::Error; use std::io; -use vidyut_prakriya::args::{KrdantaArgs, Krt}; +use vidyut_prakriya::args::{KrdantaArgs, BaseKrt}; use vidyut_prakriya::{Ashtadhyayi, Dhatupatha}; #[derive(Parser)] #[command(author, version, about)] struct Args { #[arg(long)] - krt: Krt, + krt: BaseKrt, } #[derive(Debug, Serialize)] diff --git a/vidyut-prakriya/src/bin/test_krdantas.rs b/vidyut-prakriya/src/bin/test_krdantas.rs index 3b77c66..c7529a9 100644 --- a/vidyut-prakriya/src/bin/test_krdantas.rs +++ b/vidyut-prakriya/src/bin/test_krdantas.rs @@ -2,7 +2,7 @@ use clap::Parser; use std::error::Error; use std::path::PathBuf; -use vidyut_prakriya::args::KrdantaArgs; +use vidyut_prakriya::args::{BaseKrt, KrdantaArgs}; use vidyut_prakriya::dhatupatha; use vidyut_prakriya::private::check_file_hash; use vidyut_prakriya::Ashtadhyayi; @@ -35,7 +35,7 @@ fn run(args: Args) -> Result<(), Box> { let number = &r[3]; let dhatu = dhatupatha::create_dhatu(upadesha, gana.parse()?, number.parse()?)?; - let krt = r[4].parse()?; + let krt: BaseKrt = r[4].parse()?; let krdanta_args = KrdantaArgs::builder().krt(krt).build()?; diff --git a/vidyut-prakriya/src/it_samjna.rs b/vidyut-prakriya/src/it_samjna.rs index 4239cef..972851a 100644 --- a/vidyut-prakriya/src/it_samjna.rs +++ b/vidyut-prakriya/src/it_samjna.rs @@ -180,7 +180,9 @@ pub fn run(p: &mut Prakriya, i: usize) -> Result<()> { if let Some(t) = p.get_mut(i) { if t.is_pratyaya() { - if adi == 'z' { + if t.is_unadi() && t.has_u_in(&["kan"]) { + // Do nothing. + } else if adi == 'z' { t.add_tag(T::parse_it(adi)?); temp_slice = &temp_slice[1..]; p.step("1.3.6") diff --git a/vidyut-prakriya/src/krt/basic.rs b/vidyut-prakriya/src/krt/basic.rs index 6b833f0..b78e0a7 100644 --- a/vidyut-prakriya/src/krt/basic.rs +++ b/vidyut-prakriya/src/krt/basic.rs @@ -58,9 +58,9 @@ are true: */ use crate::args::Gana; -use crate::args::Krt; use crate::args::KrtArtha::*; use crate::args::Taddhita; +use crate::args::{BaseKrt, Krt}; use crate::dhatu_gana as gana; use crate::it_samjna; use crate::krt::utils::KrtPrakriya; @@ -84,7 +84,7 @@ lazy_static! { /// Tries to add various pratyayas that are just "a." fn try_add_various_pratyayas(kp: &mut KrtPrakriya) { - use Krt::*; + use BaseKrt::*; let upapada = kp.upapada(); let upasarge = upapada.map(|t| t.is_upasarga()).unwrap_or(false); @@ -214,9 +214,9 @@ fn try_add_various_pratyayas(kp: &mut KrtPrakriya) { } else if dhatu.has_text_in(&["Sf", "vand"]) { kp.try_add("3.2.173", Aru); } else if dhatu.has_text("BI") { - if kp.krt == kruka { + if kp.expects_krt(kruka) { kp.try_add("3.2.174.v1", kruka); - } else if kp.krt == kru { + } else if kp.expects_krt(kru) { kp.try_add("3.2.174", kru); } else { kp.try_add("3.2.174", klukan); @@ -502,8 +502,8 @@ fn is_nandi_grahi_pacadi(kp: &KrtPrakriya) -> bool { dhatu.has_text_in(NAND_ADI) || dhatu.has_text_in(PAC_ADI) } -fn try_add_upapada_krt(p: &mut Prakriya, krt: Krt) -> Option { - use Krt::*; +fn try_add_upapada_krt(p: &mut Prakriya, krt: BaseKrt) -> Option { + use BaseKrt::*; const DIVA_ADI: &[&str] = &[ "divA", "viBA", "niSA", "praBA", "BAs", "kAra", "anta", "ananta", "Adi", "bahu", "nAndI", @@ -898,8 +898,8 @@ fn try_add_upapada_krt(p: &mut Prakriya, krt: Krt) -> Option { /// ("a") if their it letters are removed, and therefore the *ap* rule will block the *ghanĖƒ* rule. /// /// For details, see: -fn try_add_krt(p: &mut Prakriya, krt: Krt) -> Option { - use Krt as K; +fn try_add_krt(p: &mut Prakriya, krt: BaseKrt) -> Option { + use BaseKrt as K; let i = p.find_last(T::Dhatu)?; let prev = if i > 0 { p.get(i - 1) } else { None }; @@ -1131,7 +1131,7 @@ fn try_add_krt(p: &mut Prakriya, krt: Krt) -> Option { K::kta | K::ktavatu => { if dhatu.has_tag(T::YIt) { - kp.try_add("3.2.187", Krt::kta); + kp.try_add("3.2.187", BaseKrt::kta); } kp.try_add("3.2.102", krt); @@ -1244,6 +1244,7 @@ fn try_add_krt(p: &mut Prakriya, krt: Krt) -> Option { "zi\\Y", "zi\\ca~^", "mi\\ha~", + "patx~", "da\\nSa~", "Ra\\ha~^", ]; @@ -1364,10 +1365,14 @@ fn try_add_krt(p: &mut Prakriya, krt: Krt) -> Option { /// Runs the rules that add a krt-pratyaya to a given dhatu. Returns whether a pratyaya was added. pub fn run(p: &mut Prakriya, krt: Krt) -> bool { - if try_add_upapada_krt(p, krt).unwrap_or(false) { - return true; + if let Krt::Base(base) = krt { + if try_add_upapada_krt(p, base).unwrap_or(false) { + return true; + } + try_add_krt(p, base).unwrap_or(false) + } else { + false } - try_add_krt(p, krt).unwrap_or(false) } #[cfg(test)] @@ -1385,7 +1390,8 @@ mod tests { p } - fn allows(dhatu: &str, krt: Krt) -> bool { + fn allows(dhatu: &str, krt: impl Into) -> bool { + let krt = krt.into(); let mut p = make_prakriya(dhatu); run(&mut p, krt); p.terms().last().unwrap().has_u(krt.as_str()) @@ -1393,7 +1399,7 @@ mod tests { #[test] fn test_common_pratyayas() { - use Krt::*; + use BaseKrt::*; assert!(allows("BU", tavyat)); assert!(allows("BU", tavya)); @@ -1413,7 +1419,7 @@ mod tests { #[test] fn test_ya_pratyaya() { - use Krt::*; + use BaseKrt::*; assert!(allows("BU", yat)); // Allowed by "or AvAzyake" @@ -1431,7 +1437,7 @@ mod tests { #[test] fn test_tacchila() { - use Krt::*; + use BaseKrt::*; // 3.2.161 assert!(allows("sf\\", kmarac)); diff --git a/vidyut-prakriya/src/krt/unadi_sutras.rs b/vidyut-prakriya/src/krt/unadi_sutras.rs index 6210868..c6a8ba1 100644 --- a/vidyut-prakriya/src/krt/unadi_sutras.rs +++ b/vidyut-prakriya/src/krt/unadi_sutras.rs @@ -14,7 +14,6 @@ The pratyayas in the Unadipatha enter the Ashtadhyayi through rule 3.3.1: ### Design notes Our module below is a work-in-progress sketch and uses the version of the text available [on -ashtadhyayi.com][unadi]. For now, we have stored Unadi pratyayas on our `Krt` enum. Points in favor of this decision: @@ -34,17 +33,44 @@ As this module develops, we will probably split the Unadi pratyayas into their o [unadi]: https://ashtadhyayi.com/unaadi */ -use crate::args::Krt; +use crate::args::{Krt, Unadi}; use crate::krt::utils::KrtPrakriya; use crate::prakriya::{Prakriya, Rule}; +use crate::sounds::{s, Set}; use crate::tag::Tag as T; +use lazy_static::lazy_static; -pub fn try_add_unadi(p: &mut Prakriya, krt: Krt) -> Option { - use Krt as K; - use Rule::Unadi; +lazy_static! { + static ref NAM: Set = s("Yam"); +} + +/// A helper function that updates the pratyaya by marking it with the given `tag`. +fn mark_as(tag: T) -> impl Fn(&mut Prakriya) { + move |p| { + let i_last = p.terms().len() - 1; + p.set(i_last, |t| t.add_tag(tag)); + } +} + +fn set_text(text: &'static str) -> impl Fn(&mut Prakriya) { + move |p| { + let i_dhatu = p.terms().len() - 2; + p.set(i_dhatu, |t| t.set_text(text)); + } +} + +fn set_antya(text: &'static str) -> impl Fn(&mut Prakriya) { + move |p| { + let i_dhatu = p.terms().len() - 2; + p.set(i_dhatu, |t| t.set_antya(text)); + } +} + +pub fn try_add_unadi(p: &mut Prakriya, krt: Unadi) -> Option { + use crate::args::Unadi as U; + use Rule::UP; let i = p.find_first(T::Dhatu)?; - let prev = if i > 0 { p.get(i - 1) } else { None }; // HACK: avoid kamu~ + Nin so that we derive `kaMsa` but not `kAMsa`. if p.has(i + 1, |t| t.has_u("RiN")) { @@ -52,8 +78,6 @@ pub fn try_add_unadi(p: &mut Prakriya, krt: Krt) -> Option { } // Pre-calculate some common properties. - let upasarge = prev.map_or(false, |t| t.is_upasarga()); - let _supi = prev.map_or(false, |t| t.has_tag(T::Sup)); let nau = p.has(i + 1, |t| t.has_u("Ric")); // For convenience below, wrap `Prakriya` in a new `KrtPrakriya` type that contains `krt` and @@ -62,260 +86,383 @@ pub fn try_add_unadi(p: &mut Prakriya, krt: Krt) -> Option { let i_dhatu = kp.i_dhatu; let dhatu = kp.dhatu(); - let has_upasarga = |text| i > 0 && kp.p.has(i, |t| t.has_text(text)); + let has_upasarga = |text| i > 0 && kp.p.has(i, |t| t.is_upasarga() && t.has_text(text)); + // NOTE: some of the older code checks against the aupadeshika form of the dhatu. But since the + // commentary isn't sufficiently clear, newer code checks against the dhatu's `text` instead. match krt { - K::uR => { + U::uR => { if dhatu.has_u_in(&[ "qukf\\Y", "vA\\", "pA\\", "ji\\", "qumi\\Y", "zvada~\\", "sA\\Da~", "aSU~\\", ]) { // kAru, vAyu, ... - kp.try_add(Unadi("1.1"), krt); + kp.try_add(UP("1.1"), krt); + } else if kp.p.is_chandasi() && dhatu.has_u("i\\R") { + // Ayu + kp.try_add(UP("1.2"), krt); } } - K::YuR => { - if dhatu.has_u("tF") { + U::YuR => { + if dhatu.has_text_in(&["dF", "san", "jan", "car", "caw"]) { + kp.try_add(UP("1.3"), krt); + } else if dhatu.has_u("tF") { // tAlu - kp.try_add_with(Unadi("1.5"), krt, |p| { + kp.try_add_with(UP("1.5"), krt, |p| { p.set(i_dhatu, |t| t.set_antya("l")); }); } } - K::wizac => { + U::u => { + if dhatu.has_text_in(&[ + "Bf", "mf", "SI", "tF", "car", "tsar", "tan", "Dan", "mi", "masj", + ]) { + kp.try_add(UP("1.7"), krt); + } else if dhatu.has_text_in(&[ + "SF", "svf", "snih", "trap", "as", "vas", "han", "klid", "banD", "man", + ]) { + kp.try_add(UP("1.10"), krt); + } else if dhatu.has_text("syand") { + kp.try_add_with(UP("1.11"), krt, set_text("sinD")); + } else if dhatu.has_text("und") { + kp.try_add_with(UP("1.12"), krt, set_text("ind")); + } else if dhatu.has_text("Iz") { + kp.try_add_with(UP("1.13"), krt, |p| { + p.set(i, |t| t.set_text("iz")); + p.set(i + 1, |t| t.add_tag(T::kit)); + }); + } else if dhatu.has_text("skand") { + kp.try_add_with(UP("1.14"), krt, set_text("kand")); + } else if dhatu.has_text("sfj") { + kp.try_add_with(UP("1.15"), krt, set_text("rajj")); + } else if dhatu.has_text("kft") { + kp.try_add_with(UP("1.16"), krt, set_text("tfk")); + } else if dhatu.has_text("yA") { + kp.try_add_with(UP("1.21"), krt, set_text("yay")); + } + } + U::wizac => { if dhatu.has_u_in(&["ava~", "maha~"]) { - kp.try_add(Unadi("1.45"), krt); + kp.try_add(UP("1.45"), krt); } } - K::tun => { + U::tun => { if dhatu.has_u_in(&[ "zi\\Y", "tanu~^", "ga\\mx~", "masI~", "zaca~\\", "ava~", "quDA\\Y", "kru\\Sa~", ]) { - kp.try_add(Unadi("1.69"), krt); + kp.try_add(UP("1.69"), krt); } } - K::katu => { + U::katu => { if dhatu.has_u("qukf\\Y") { // kratu - kp.try_add(Unadi("1.77"), krt); + kp.try_add(UP("1.77"), krt); + } + } + U::qa => { + if dhatu.has_antya(&*NAM) { + kp.try_add(UP("1.111"), krt); + } + } + U::AlaY => { + if dhatu.has_text_in(&["pat", "caRq"]) { + kp.try_add(UP("1.114"), krt); + } + } + U::kAlan => { + if dhatu.has_text_in(&["tam", "viS", "biq", "mfR", "kul", "kap", "pal", "paYc"]) { + kp.try_add(UP("1.115"), krt); + } + } + U::man => { + if dhatu.has_text("gras") { + kp.try_add_with(UP("1.140"), krt, set_antya("A")); + } else if dhatu.has_text_in(&["av", "siv", "si", "Suz"]) { + kp.try_add_with(UP("1.141"), krt, mark_as(T::kit)); + } + } + U::mak => { + if dhatu.has_text_in(&["iz", "yuD", "inD", "das", "SyE", "DU", "sU"]) { + kp.try_add(UP("1.142"), krt); + } else if dhatu.has_text_in(&["yuj", "ruc", "tij"]) { + // TODO: kuSca? + kp.try_add(UP("1.143"), krt); + } else if dhatu.has_text("han") { + kp.try_add_with(UP("1.144"), krt, set_text("hi")); + } else if dhatu.has_text("Gf") { + kp.try_add_with(UP("1.146"), krt, set_text("Gar")); + } else if dhatu.has_text("gras") { + kp.try_add_with(UP("1.147"), krt, set_text("grIz")); + } + } + U::eRu => { + if dhatu.has_text_in(&["kf", "hf"]) { + kp.try_add(UP("2.1"), krt); } } - K::kTan => { + U::kTan => { if dhatu.has_u_in(&["ha\\na~", "kuza~", "RI\\Y", "ama~", "kASf~"]) { - kp.try_add(Unadi("2.2"), krt); + kp.try_add(UP("2.2"), krt); + } + } + U::sTan => { + if dhatu.has_text_in(&["uz", "kuz", "gA", "f"]) { + kp.try_add(UP("2.4"), krt); + } else if dhatu.has_text("sf") { + kp.try_add_with(UP("2.5"), krt, mark_as(T::Rit)); } } - K::isi => { + U::kran => { + if dhatu.has_text_in(&["su", "sU", "DA", "gfD"]) { + kp.try_add(UP("2.25"), krt); + } + } + U::isi => { if dhatu.has_u_in(&["arca~", "I~Suci~^r", "hu\\", "sf\\px~", "Cada~", "Carda~"]) { - kp.try_add(Unadi("2.108"), krt); + kp.try_add(UP("2.108"), krt); // TODO: id-antaH api } } - K::usi => { + U::usi => { if dhatu.has_u("janI~\\") { - kp.try_add(Unadi("2.115"), krt); + kp.try_add(UP("2.115"), krt); } else if dhatu.has_text_in(&["f", "pF", "vap", "yaj", "tan", "Dan", "tap"]) { - kp.try_add_with(Unadi("2.117"), krt, |p| p.set(i + 1, |t| t.add_tag(T::nit))); + kp.try_add_with(UP("2.117"), krt, mark_as(T::nit)); } else if dhatu.has_u("i\\R") { - kp.try_add_with(Unadi("2.118"), krt, |p| p.set(i + 1, |t| t.add_tag(T::Rit))); + kp.try_add_with(UP("2.118"), krt, mark_as(T::Rit)); } else if dhatu.has_u("ca\\kzi~\\N") { - kp.try_add_with(Unadi("2.119"), krt, |p| p.set(i + 1, |t| t.add_tag(T::Sit))); + kp.try_add_with(UP("2.119"), krt, mark_as(T::Sit)); } else if dhatu.has_text("muh") { - kp.try_add_with(Unadi("2.120"), krt, |p| p.set(i + 1, |t| t.add_tag(T::kit))); + kp.try_add_with(UP("2.120"), krt, mark_as(T::kit)); } } - K::itnuc => { + U::itnuc => { if dhatu.has_u_in(&["stana", "hfza~", "gada", "mada~", "spfha", "gfha"]) && nau { // stanayitnu, ... // TODO: popi? - kp.try_add(Unadi("3.29"), krt); + kp.try_add(UP("3.29"), krt); } } - K::kan => { + U::kan => { if dhatu.has_u_in(&["i\\R", "YiBI\\", "kE\\", "pA\\", "Sala~", "ata~", "marca~"]) { - kp.try_add(Unadi("3.43"), krt); + kp.try_add(UP("3.43"), krt); } } - K::sa => { + U::sa => { if dhatu.has_u_in(&["vF", "vFY", "tF", "vada~", "ha\\na~", "kamu~\\", "kaza~"]) { - kp.try_add(Unadi("3.62"), krt); + kp.try_add(UP("3.62"), krt); } } - K::sara => { + U::sara => { if dhatu.has_u("aSU~\\") { // akzara - kp.try_add(Unadi("3.70"), krt); + kp.try_add(UP("3.70"), krt); } } - K::tan => { + U::tan => { if dhatu.has_u_in(&[ "hase~", "mf\\N", "gF", "i\\R", "vA\\", "ama~", "damu~", "lUY", "pUY", "DurvI~", ]) { // hasta, ... - kp.try_add(Unadi("3.86"), krt); + kp.try_add(UP("3.86"), krt); } } - K::Ayya => { + U::Ayya => { if dhatu.has_u_in(&["Sru\\", "dakza~\\", "spfha", "gfha"]) { // hasta, ... - kp.try_add(Unadi("3.96"), krt); + kp.try_add(UP("3.96"), krt); } } - K::Jac => { + U::Jac => { if dhatu.has_text_in(&["jF", "viS"]) { // jaranta, veSanta - kp.try_add(Unadi("3.126"), krt); + kp.try_add(UP("3.126"), krt); } else if dhatu.has_text_in(&["ruh", "nand", "jIv"]) - || (upasarge && has_upasarga("pra") && dhatu.has_text("an")) + || (has_upasarga("pra") && dhatu.has_text("an")) { - kp.try_add_with(Unadi("3.127"), krt, |p| { - p.set(i_dhatu + 1, |t| t.add_tag(T::zit)); - }); + kp.try_add_with(UP("3.127"), krt, mark_as(T::zit)); // rohanta, nadanta ... } else if dhatu .has_text_in(&["tF", "BU", "vah", "vas", "BAs", "sAD", "gaRq", "maRq", "ji"]) { // taranta, Bavanta, ... // TODO: nandayanta - kp.try_add_with(Unadi("3.128"), krt, |p| { - p.set(i_dhatu + 1, |t| t.add_tag(T::zit)); - }); + kp.try_add_with(UP("3.128"), krt, mark_as(T::zit)); } } - - K::ksi => { + U::apa => { + if dhatu.has_text("f") { + kp.try_add_with(UP("3.141"), krt, |p| p.set(i, |t| t.text += "z")); + } + } + U::kapan => { + if dhatu.has_text_in(&["uz", "kuw", "dal", "kac", "Kaj"]) { + kp.try_add(UP("3.142"), krt); + } else if dhatu.has_text("kvaR") { + kp.try_add(UP("3.143"), krt); + } + } + U::tikan => { + if dhatu.has_text("vft") { + kp.try_add(UP("3.146"), krt); + } else if dhatu.has_text_in(&["kft", "Bid", "lat"]) { + kp.try_add_with(UP("3.147"), krt, mark_as(T::kit)); + } + } + U::ksi => { if dhatu.has_u_in(&["pluza~", "kuza~", "Su\\za~"]) { - kp.try_add(Unadi("3.155"), krt); + kp.try_add(UP("3.155"), krt); } else if dhatu.has_u("aSU~") { - kp.try_add_with(Unadi("3.156"), krt, |p| { - p.set(i_dhatu + 1, |t| t.add_tag(T::nit)) - }); + kp.try_add_with(UP("3.156"), krt, mark_as(T::nit)); } } - K::ksu => { + U::ksu => { if dhatu.has_u("izu~") { // ikzu - kp.try_add(Unadi("3.157"), krt); - } - } - K::katnic - | K::yatuc - | K::alic - | K::izWuc - | K::izWac - | K::isan - | K::syan - | K::iTin - | K::uli - | K::asa - | K::Asa - | K::Anuk => { - let code = Unadi("4.2"); + kp.try_add(UP("3.157"), krt); + } + } + U::katnic + | U::yatuc + | U::alic + | U::izWuc + | U::izWac + | U::isan + | U::syan + | U::iTin + | U::uli + | U::asa + | U::Asa + | U::Anuk => { + let code = UP("4.2"); let has_u = |u| dhatu.has_u(u); match krt { - K::katnic if dhatu.has_u("f\\") => { + U::katnic if dhatu.has_u("f\\") => { kp.try_add(code, krt); } - K::yatuc if dhatu.has_u("tanu~^") => { + U::yatuc if dhatu.has_u("tanu~^") => { kp.try_add(code, krt); } - K::alic if dhatu.has_u("anjU~") => { + U::alic if dhatu.has_u("anjU~") => { // aYjali kp.try_add(code, krt); } - K::izWuc if dhatu.has_u("vana~") => { + U::izWuc if dhatu.has_u("vana~") => { kp.try_add(code, krt); } - K::izWac if dhatu.has_u("anjU~") => { + U::izWac if dhatu.has_u("anjU~") => { kp.try_add(code, krt); } - K::isan if dhatu.has_u("f\\") && kp.p.has(i + 2, |t| t.has_u("Ric")) => { + U::isan if dhatu.has_u("f\\") && kp.p.has(i + 2, |t| t.has_u("Ric")) => { // `i + 2` to skip pu~k (ar + p + i) kp.try_add(code, krt); } - K::syan if dhatu.has_u("madI~") => { + U::syan if dhatu.has_u("madI~") => { // matsya kp.try_add(code, krt); } - K::iTin if dhatu.has_u("ata~") => { + U::iTin if dhatu.has_u("ata~") => { // atiTi kp.try_add(code, krt); } - K::uli if dhatu.has_u("anga") => { + U::uli if dhatu.has_u("anga") => { // aNguli kp.try_add(code, krt); } - K::asa if dhatu.has_u("ku\\") => { + U::asa if dhatu.has_u("ku\\") => { kp.try_add(code, krt); } // TODO: kavaca? - K::Asa if has_u("yu") => { + U::Asa if has_u("yu") => { kp.try_add(code, krt); } - K::Anuk if has_u("kfSa~") => { + U::Anuk if has_u("kfSa~") => { kp.try_add(code, krt); } _ => (), }; } - K::ini => { - let set_nit = |p: &mut Prakriya| p.set(i_dhatu + 1, |t| t.add_tag(T::Rit)); - let set_kit = |p: &mut Prakriya| p.set(i_dhatu + 1, |t| t.add_tag(T::kit)); + U::ini => { if dhatu.has_u("ga\\mx~") { if kp.has_upapada("AN") { - kp.try_add_with(Unadi("4.7"), krt, set_nit); + kp.try_add_with(UP("4.7"), krt, mark_as(T::Rit)); } else { - kp.try_add(Unadi("4.6"), krt); + kp.try_add(UP("4.6"), krt); } } else if dhatu.has_u("BU") { - kp.try_add_with(Unadi("4.8"), krt, set_nit); + kp.try_add_with(UP("4.8"), krt, mark_as(T::Rit)); } else if dhatu.has_u("zWA\\") { if kp.has_upapada("pra") { // prasTAyin - kp.try_add_with(Unadi("4.9"), krt, set_nit); + kp.try_add_with(UP("4.9"), krt, mark_as(T::Rit)); } else { // paramezWin - kp.try_add_with(Unadi("4.10"), krt, set_kit); + kp.try_add_with(UP("4.10"), krt, mark_as(T::kit)); } } else if dhatu.has_u("maTi~") { // maTin - kp.try_add_with(Unadi("4.11"), krt, set_kit); + kp.try_add_with(UP("4.11"), krt, mark_as(T::kit)); } else if dhatu.has_u("patx~") { // paTin - kp.try_add_with(Unadi("4.12"), krt, |p| p.set(i, |t| t.set_antya("T"))); + kp.try_add_with(UP("4.12"), krt, set_antya("T")); } } - K::kvinUnadi => { + U::kvin => { if dhatu.has_u_in(&["jF", "SFY", "stFY", "jAgf"]) { - kp.try_add(Unadi("4.54"), krt); + kp.try_add(UP("4.54"), krt); } } - K::in_ => { - kp.try_add(Unadi("4.117"), krt); + U::aru => { + if dhatu.has_text("f") { + kp.try_add(UP("4.79"), krt); + } else if dhatu.has_text("kuw") { + kp.try_add_with(UP("4.80"), krt, mark_as(T::kit)); + } } - K::manin => { - kp.try_add(Unadi("4.144"), krt); + U::abac => { + if dhatu.has_text_in(&["kf", "kad", "kaq", "kaw"]) { + if dhatu.has_text("kad") { + kp.optional_try_add_with(UP("4.82"), krt, mark_as(T::Rit)); + } + kp.try_add(UP("4.81"), krt); + } } - K::zwran => { - kp.try_add(Unadi("4.158"), krt); + U::ama => { + if dhatu.has_text_in(&["kal", "kard"]) { + kp.try_add(UP("4.83"), krt); + } } - K::asun => { + U::kindac => { + if dhatu.has_text_in(&["kuR", "pul"]) { + kp.try_add(UP("4.84"), krt); + } + } + U::in_ => { + kp.try_add(UP("4.117"), krt); + } + U::manin => { + kp.try_add(UP("4.144"), krt); + } + U::zwran => { + kp.try_add(UP("4.158"), krt); + } + U::asun => { if dhatu.has_text("rap") { - kp.try_add_with(Unadi("4.189"), krt, |p| p.set(i, |t| t.set_upadha("e"))); + kp.try_add_with(UP("4.189"), krt, |p| p.set(i, |t| t.set_upadha("e"))); } else { - kp.try_add(Unadi("4.188"), krt); + kp.try_add(UP("4.188"), krt); } } - K::amac => { + U::amac => { if dhatu.has_u("praTa~\\") { - kp.try_add(Unadi("5.68"), krt); + kp.try_add(UP("5.68"), krt); } else if dhatu.has_u("cara~") { - kp.try_add(Unadi("5.69"), krt); + kp.try_add(UP("5.69"), krt); } } - K::alac if dhatu.has_u("magi~") => { + U::alac if dhatu.has_u("magi~") => { // maNgala - kp.try_add(Unadi("5.70"), krt); + kp.try_add(UP("5.70"), krt); } _ => (), } @@ -324,5 +471,9 @@ pub fn try_add_unadi(p: &mut Prakriya, krt: Krt) -> Option { } pub fn run(p: &mut Prakriya, krt: Krt) -> bool { - try_add_unadi(p, krt).unwrap_or(false) + if let Krt::Unadi(unadi) = krt { + try_add_unadi(p, unadi).unwrap_or(false) + } else { + false + } } diff --git a/vidyut-prakriya/src/krt/utils.rs b/vidyut-prakriya/src/krt/utils.rs index b9f8e8d..f33fb66 100644 --- a/vidyut-prakriya/src/krt/utils.rs +++ b/vidyut-prakriya/src/krt/utils.rs @@ -1,4 +1,4 @@ -use crate::args::{Artha, Krt, KrtArtha}; +use crate::args::{Artha, BaseKrt, Krt, KrtArtha}; use crate::it_samjna; use crate::operators as op; use crate::prakriya::{Prakriya, Rule}; @@ -8,18 +8,25 @@ use crate::term::Term; impl Krt { /// Converts this krt-pratyaya to an appropriate `Term`. pub fn to_term(self) -> Term { - use Krt as K; let mut krt = Term::make_upadesha(self.as_str()); krt.add_tags(&[T::Pratyaya, T::Krt]); - // Any rule that adds `krtya` also includes the `krtya` samjna by adhikara from 3.1.95. - // Other samjnas, such as `Nistha`, are added in separate rules and are thus modeled - // separately. - if matches!( - self, - K::tavyat | K::tavya | K::anIyar | K::yat | K::kyap | K::Ryat - ) { - krt.add_tag(T::Krtya); + if let Krt::Base(b) = self { + use BaseKrt as K; + + // Any rule that adds a krtya-pratyaya also includes the `krtya` samjna by adhikara + // from 3.1.95. Other samjnas, such as `Nistha`, are added in separate rules and are + // thus modeled separately. + if matches!( + b, + K::tavyat | K::tavya | K::anIyar | K::yat | K::kyap | K::Ryat + ) { + krt.add_tag(T::Krtya); + } + } + + if let Krt::Unadi(_) = self { + krt.add_tag(T::Unadi); } krt @@ -45,12 +52,12 @@ pub struct KrtPrakriya<'a> { impl<'a> KrtPrakriya<'a> { /// Creates a new `KrtPrakriya` struct. - pub fn new(p: &'a mut Prakriya, krt: Krt) -> Self { + pub fn new(p: &'a mut Prakriya, krt: impl Into) -> Self { let i_dhatu = p.find_first_where(|t| t.is_dhatu()).unwrap_or(0); KrtPrakriya { p, i_dhatu, - krt, + krt: krt.into(), rule_artha: None, had_match: false, has_krt: false, @@ -87,6 +94,10 @@ impl<'a> KrtPrakriya<'a> { self.i_dhatu > 0 && self.p.has(self.i_dhatu - 1, |t| t.has_u_in(upadeshas)) } + pub fn expects_krt(&self, krt: impl Into) -> bool { + self.krt == krt.into() + } + /// Runs the rules in `closure` under the meaning condition defined in `artha`. /// /// Calls to `with_context` can be nested. @@ -136,14 +147,20 @@ impl<'a> KrtPrakriya<'a> { /// If there's a match, adds the given `krt` pratyaya. /// /// This method does nothing if a krt pratyaya has already been added. - pub fn try_add(&mut self, rule: impl Into, krt: Krt) -> bool { + pub fn try_add(&mut self, rule: impl Into, krt: impl Into) -> bool { self.try_add_with(rule, krt, |_| {}) } /// If there's a match, replace the `lakAra` of the dhatu. /// /// This method does nothing if a krt pratyaya has already been added. - pub fn try_replace_lakara(&mut self, rule: impl Into, i_lakara: usize, krt: Krt) -> bool { + pub fn try_replace_lakara( + &mut self, + rule: impl Into, + i_lakara: usize, + krt: impl Into, + ) -> bool { + let krt = krt.into(); self.had_match = true; if self.krt == krt && !self.has_krt { op::adesha(rule, self.p, i_lakara, krt.as_str()); @@ -176,10 +193,11 @@ impl<'a> KrtPrakriya<'a> { pub fn try_add_with( &mut self, rule: impl Into, - krt: Krt, + krt: impl Into, func: impl Fn(&mut Prakriya), ) -> bool { let rule = rule.into(); + let krt = krt.into(); self.had_match = true; if self.krt == krt && !self.has_krt { @@ -208,9 +226,12 @@ impl<'a> KrtPrakriya<'a> { pub fn optional_try_add_with( &mut self, rule: impl Into + Copy, - krt: Krt, + krt: impl Into, func: impl Fn(&mut Prakriya), ) -> bool { + let rule = rule.into(); + let krt = krt.into(); + if krt == self.krt && !self.has_krt { // TODO: resolve inconsistency with TaddhitaPratyaya::optional_try_add_with. if self.p.is_allowed(rule) { @@ -226,21 +247,21 @@ impl<'a> KrtPrakriya<'a> { /// If there's a match, optionally adds the given `krt` pratyaya. /// /// This method does nothing if a krt pratyaya has already been added. - pub fn optional_try_add(&mut self, rule: impl Into + Copy, krt: Krt) -> bool { + pub fn optional_try_add(&mut self, rule: impl Into + Copy, krt: BaseKrt) -> bool { self.optional_try_add_with(rule, krt, |_| {}) } /// Like `optional` but indicates a specific choice of artha. Not sure how to use this yet, but /// at some point we should model specific semantic choices as different from an ordinary /// option. - pub fn try_artha_add(&mut self, rule: impl Into + Copy, krt: Krt) -> bool { + pub fn try_artha_add(&mut self, rule: impl Into + Copy, krt: BaseKrt) -> bool { self.optional_try_add(rule, krt) } pub fn try_artha_add_with( &mut self, rule: impl Into + Copy, - krt: Krt, + krt: BaseKrt, func: impl Fn(&mut Prakriya), ) -> bool { self.optional_try_add_with(rule, krt, func) diff --git a/vidyut-prakriya/src/prakriya.rs b/vidyut-prakriya/src/prakriya.rs index 3afa94a..dcf8e8f 100644 --- a/vidyut-prakriya/src/prakriya.rs +++ b/vidyut-prakriya/src/prakriya.rs @@ -20,7 +20,7 @@ pub enum Rule { /// A sutra from the Dhatupatha. Dhatupatha(&'static str), /// A sutra from the Unadipatha. - Unadi(&'static str), + UP(&'static str), /// A sutra from the Paniniya-Linganushasanam. Linganushasana(&'static str), /// A quotation from the Vaiyakarana-siddhanta-kaumudi. @@ -34,7 +34,7 @@ impl Rule { Self::Ashtadhyayi(x) => x, Self::Kashika(x) => x, Self::Dhatupatha(x) => x, - Self::Unadi(x) => x, + Self::UP(x) => x, Self::Linganushasana(x) => x, Self::Kaumudi(x) => x, } @@ -86,6 +86,7 @@ pub enum RuleChoice { pub struct Config { pub rule_choices: Vec, pub log_steps: bool, + pub is_chandasi: bool, } impl Config { @@ -536,7 +537,7 @@ impl Prakriya { /// Returns whether the prakriya allows chAndasa rules. pub(crate) fn is_chandasi(&self) -> bool { - false + self.config.is_chandasi } pub(crate) fn is_allowed(&mut self, r: impl Into) -> bool { diff --git a/vidyut-prakriya/src/prakriya_stack.rs b/vidyut-prakriya/src/prakriya_stack.rs index 131259e..0f28315 100644 --- a/vidyut-prakriya/src/prakriya_stack.rs +++ b/vidyut-prakriya/src/prakriya_stack.rs @@ -8,6 +8,11 @@ use crate::prakriya::{Config, Prakriya, RuleChoice}; /// and exploring the various combinations of optional rules. #[derive(Default)] pub(crate) struct PrakriyaStack { + /// Whether a prakriya should log its steps. + log_steps: bool, + /// Whether a prakriya should use chAndasa rules. + is_chandasi: bool, + /// Completed prakriyas. prakriyas: Vec, /// Combinations of optional rules that we have yet to try. @@ -16,26 +21,32 @@ pub(crate) struct PrakriyaStack { impl PrakriyaStack { /// Creates an empty `PrakriyaStack`. - pub fn new() -> Self { - Self::default() + pub fn new(log_steps: bool, is_chandasi: bool) -> Self { + Self { + prakriyas: Vec::new(), + paths: Vec::new(), + log_steps, + is_chandasi, + } } /// Creates a new `Prakriya` according to upstream options. - fn new_prakriya(rule_choices: Vec, log_steps: bool) -> Prakriya { + fn new_prakriya(&self, rule_choices: Vec) -> Prakriya { Prakriya::with_config(Config { rule_choices, - log_steps, + log_steps: self.log_steps, + is_chandasi: self.is_chandasi, }) } /// Finds all variants of the given derivation function. /// /// `derive` should accept an empty `Prakriya` and mutate it in-place. - pub fn find_all(&mut self, derive: impl Fn(Prakriya) -> Result, log_steps: bool) { + pub fn find_all(&mut self, derive: impl Fn(Prakriya) -> Result) { self.paths.push(vec![]); while let Some(path) = self.pop_path() { - let p_init = Self::new_prakriya(path.clone(), log_steps); + let p_init = self.new_prakriya(path.clone()); match derive(p_init) { Ok(p) => { self.add_new_paths(&p, &path); diff --git a/vidyut-prakriya/src/tag.rs b/vidyut-prakriya/src/tag.rs index e971e3a..444f3d2 100644 --- a/vidyut-prakriya/src/tag.rs +++ b/vidyut-prakriya/src/tag.rs @@ -21,6 +21,7 @@ pub enum Tag { Avyaya, Agama, Pratyaya, + Unadi, Pratipadika, Vibhakti, Sarvanama, diff --git a/vidyut-prakriya/src/term.rs b/vidyut-prakriya/src/term.rs index c7a23f5..882bd6a 100644 --- a/vidyut-prakriya/src/term.rs +++ b/vidyut-prakriya/src/term.rs @@ -320,6 +320,11 @@ impl Term { self.has_tag(Tag::Pratyaya) } + /// Returns whether the term is an unAdi-pratyaya. + pub fn is_unadi(&self) -> bool { + self.has_tag(Tag::Unadi) + } + pub fn is_nyap_pratyaya(&self) -> bool { self.has_tag(Tag::Pratyaya) && self.has_u_in(&["wAp", "cAp", "dAp", "NIp", "NIz"]) } diff --git a/vidyut-prakriya/src/wasm.rs b/vidyut-prakriya/src/wasm.rs index ec679d3..9a769cf 100644 --- a/vidyut-prakriya/src/wasm.rs +++ b/vidyut-prakriya/src/wasm.rs @@ -56,7 +56,7 @@ impl Rule { Self::Kashika(s) => format!("kAzikA {s}"), Self::Linganushasana(s) => format!("liNgA {s}"), Self::Kaumudi(s) => format!("kOmudI {s}"), - Self::Unadi(s) => format!("uRAdi {s}"), + Self::UP(s) => format!("uRAdi {s}"), } } } @@ -189,7 +189,7 @@ impl Vidyut { pub fn deriveKrdantas( &self, code: &str, - krt: Krt, + krt: BaseKrt, sanadi: Option, upasarga: Option, ) -> JsValue { diff --git a/vidyut-prakriya/test_utils/src/lib.rs b/vidyut-prakriya/test_utils/src/lib.rs index 993e3a6..fc21113 100644 --- a/vidyut-prakriya/test_utils/src/lib.rs +++ b/vidyut-prakriya/test_utils/src/lib.rs @@ -7,6 +7,7 @@ manage the boilerplate required for these assertions. extern crate vidyut_prakriya; use vidyut_prakriya::args::Antargana; +use vidyut_prakriya::args::Purusha as P; use vidyut_prakriya::args::Vacana::*; use vidyut_prakriya::args::Vibhakti::*; use vidyut_prakriya::args::*; @@ -14,6 +15,362 @@ use vidyut_prakriya::Ashtadhyayi; use vidyut_prakriya::Prakriya; use vidyut_prakriya::Rule; +/// A handy way to manage various assertions. +/// +/// `Ashtadhyayi` with its default settings will ignore certain rules. Some of these rules are +/// chAndasa rules, meaning that they apply only in Vedic usage. Other rules are valid options but +/// will overgenerate, which adds too much noise to our other tests. +/// +/// To test these ignored rules, we can create a new `Tester` that uses the `Ashtadhyayi` settings we +/// specify. For convenience, all of these methods have wrapper functions that assume the +/// default settings for `Ashtadhyayi`. +pub struct Tester { + ashtadhyayi: Ashtadhyayi, +} + +impl Tester { + /// Creates a tester with our default settings. + pub fn new(ashtadhyayi: Ashtadhyayi) -> Self { + Self { ashtadhyayi } + } + + /// Creates a tester that enables chAndasa rules. + pub fn with_chaandasa() -> Self { + Self { + ashtadhyayi: Ashtadhyayi::builder().is_chandasa(true).build(), + } + } + + /// Asserts that the given input conditions produce the tinantas `expected`. + fn assert_has_tin( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + lakara: Lakara, + purusha: Purusha, + vacana: Vacana, + expected: &[&str], + ) { + let args = TinantaArgs::builder() + .prayoga(Prayoga::Kartari) + .purusha(purusha) + .vacana(vacana) + .lakara(lakara) + .build() + .unwrap(); + let actual = derive_tinantas( + &self.ashtadhyayi, + &dhatu.clone().with_prefixes(prefixes), + &args, + ); + assert_padas(actual, expected); + } + + /// Asserts that the given input conditions produce the parasmaipada tinantas in `expected`. + fn assert_has_parasmai_tin( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + lakara: Lakara, + purusha: Purusha, + vacana: Vacana, + expected: &[&str], + ) { + let args = TinantaArgs::builder() + .prayoga(Prayoga::Kartari) + .purusha(purusha) + .vacana(vacana) + .lakara(lakara) + .pada(Pada::Parasmai) + .build() + .unwrap(); + let actual = derive_tinantas( + &self.ashtadhyayi, + &dhatu.clone().with_prefixes(prefixes), + &args, + ); + assert_padas(actual, expected); + } + + /// Asserts that the given input conditions produce the Atmanepada tinantas in `expected`. + fn assert_has_atmane_tin( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + lakara: Lakara, + purusha: Purusha, + vacana: Vacana, + expected: &[&str], + ) { + let args = TinantaArgs::builder() + .prayoga(Prayoga::Kartari) + .purusha(purusha) + .vacana(vacana) + .lakara(lakara) + .pada(Pada::Atmane) + .build() + .unwrap(); + let actual = derive_tinantas( + &self.ashtadhyayi, + &dhatu.clone().with_prefixes(prefixes), + &args, + ); + assert_padas(actual, expected); + } + + /// Asserts that the given input conditions produce the karmaNi-prayoga tinantas in `expected`. + pub fn assert_has_karmani_tin( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + lakara: Lakara, + purusha: Purusha, + vacana: Vacana, + expected: &[&str], + ) { + let args = TinantaArgs::builder() + .prayoga(Prayoga::Karmani) + .purusha(purusha) + .vacana(vacana) + .lakara(lakara) + .build() + .unwrap(); + let actual = derive_tinantas( + &self.ashtadhyayi, + &dhatu.clone().with_prefixes(prefixes), + &args, + ); + assert_padas(actual, expected); + } + + /// Asserts that the given input conditions produce the prathamA-eka tinantas in `expected` + fn assert_has_lakara(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_tin(prefixes, dhatu, la, P::Prathama, Eka, expected); + } + + pub fn assert_has_tip(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Prathama, Eka, expected); + } + + pub fn assert_has_tas(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Prathama, Dvi, expected); + } + + pub fn assert_has_jhi(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Prathama, Bahu, expected); + } + + pub fn assert_has_sip(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Madhyama, Eka, expected); + } + + pub fn assert_has_thas(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Madhyama, Dvi, expected); + } + + pub fn assert_has_tha(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Madhyama, Bahu, expected); + } + + pub fn assert_has_mip(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Uttama, Eka, expected); + } + + pub fn assert_has_vas(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Uttama, Dvi, expected); + } + + pub fn assert_has_mas(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_parasmai_tin(prefixes, dhatu, la, P::Uttama, Bahu, expected); + } + + pub fn assert_has_ta(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Prathama, Eka, expected); + } + + pub fn assert_has_aataam( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Prathama, Dvi, expected); + } + + pub fn assert_has_jha(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Prathama, Bahu, expected); + } + + pub fn assert_has_thaas( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Madhyama, Eka, expected); + } + + pub fn assert_has_aathaam( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Madhyama, Dvi, expected); + } + + pub fn assert_has_dhvam( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Madhyama, Bahu, expected); + } + + pub fn assert_has_iw(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Uttama, Eka, expected); + } + + pub fn assert_has_vahi(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Uttama, Dvi, expected); + } + + pub fn assert_has_mahin( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_atmane_tin(prefixes, dhatu, la, P::Uttama, Bahu, expected); + } + + pub fn assert_has_ta_k(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Prathama, Eka, expected); + } + + pub fn assert_has_aataam_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Prathama, Dvi, expected); + } + + pub fn assert_has_jha_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Prathama, Bahu, expected); + } + + pub fn assert_has_thaas_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Madhyama, Eka, expected); + } + + pub fn assert_has_aathaam_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Madhyama, Dvi, expected); + } + + pub fn assert_has_dhvam_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Madhyama, Bahu, expected); + } + + pub fn assert_has_iw_k(&self, prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Uttama, Eka, expected); + } + + pub fn assert_has_vahi_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Uttama, Dvi, expected); + } + + pub fn assert_has_mahin_k( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + la: Lakara, + expected: &[&str], + ) { + self.assert_has_karmani_tin(prefixes, dhatu, la, P::Uttama, Bahu, expected); + } + + fn assert_has_sup( + &self, + pratipadika: &Pratipadika, + linga: Linga, + vibhakti: Vibhakti, + vacana: Vacana, + expected: &[&str], + ) { + let args = SubantaArgs::builder() + .linga(linga) + .vacana(vacana) + .vibhakti(vibhakti) + .build() + .unwrap(); + + let results = self.ashtadhyayi.derive_subantas(pratipadika, &args); + let actual = sanitize_results(results); + assert_padas(actual, expected); + } + + pub fn assert_has_krt( + &self, + prefixes: &[&str], + dhatu: &Dhatu, + krt: impl Into, + expected: &[&str], + ) { + let args = KrdantaArgs::builder().krt(krt.into()).build().unwrap(); + let actual = derive_krdantas( + &self.ashtadhyayi, + &dhatu.clone().with_prefixes(prefixes), + args, + ); + assert_padas(actual, expected); + } +} + +impl Default for Tester { + fn default() -> Self { + Self::new(Ashtadhyayi::new()) + } +} + // Derivation helpers // ------------------ @@ -35,15 +392,13 @@ fn sanitize_results(mut results: Vec) -> Vec { } /// Derives tinantas from the given initial conditions. -fn derive_tinantas(dhatu: &Dhatu, args: &TinantaArgs) -> Vec { - let a = Ashtadhyayi::new(); +fn derive_tinantas(a: &Ashtadhyayi, dhatu: &Dhatu, args: &TinantaArgs) -> Vec { let results = a.derive_tinantas(dhatu, args); sanitize_results(results) } /// Derives krdantas from the given initial conditions. -fn derive_krdantas(dhatu: &Dhatu, args: KrdantaArgs) -> Vec { - let a = Ashtadhyayi::new(); +fn derive_krdantas(a: &Ashtadhyayi, dhatu: &Dhatu, args: KrdantaArgs) -> Vec { let mut results = a.derive_krdantas(dhatu, &args); results.sort_by_key(|p| p.text()); results.dedup_by_key(|p| p.text()); @@ -68,12 +423,6 @@ fn derive_taddhitantas(p: &Pratipadika, t: Taddhita, a: Option) - sanitize_results(results) } -fn derive_subantas(pratipadika: &Pratipadika, args: SubantaArgs) -> Vec { - let a = Ashtadhyayi::new(); - let results = a.derive_subantas(pratipadika, &args); - sanitize_results(results) -} - /// Derives vakyas from the given initial conditions. fn derive_vakyas(first: &str, second: &str) -> Vec { let a = Ashtadhyayi::new(); @@ -83,33 +432,6 @@ fn derive_vakyas(first: &str, second: &str) -> Vec { results } -/// Derives the prathama-eka forms of the given lakara. -fn derive_lakara(prefixes: &[&str], dhatu: &Dhatu, lakara: Lakara) -> Vec { - let dhatu = dhatu.clone().with_prefixes(prefixes); - let args = TinantaArgs::builder() - .prayoga(Prayoga::Kartari) - .purusha(Purusha::Prathama) - .vacana(Eka) - .lakara(lakara) - .build() - .unwrap(); - - derive_tinantas(&dhatu, &args) -} - -/// Derives the karmani-prathama-eka forms of the given lakara. -fn derive_karmani(prefixes: &[&str], dhatu: &Dhatu, lakara: Lakara) -> Vec { - let dhatu = dhatu.clone().with_prefixes(prefixes); - let args = TinantaArgs::builder() - .prayoga(Prayoga::Karmani) - .purusha(Purusha::Prathama) - .vacana(Eka) - .lakara(lakara) - .build() - .unwrap(); - derive_tinantas(&dhatu, &args) -} - fn debug_text(rule: Rule) -> String { match rule { Rule::Ashtadhyayi(x) => x.to_string(), @@ -117,7 +439,7 @@ fn debug_text(rule: Rule) -> String { Rule::Kashika(x) => format!("kA {x}"), Rule::Kaumudi(x) => format!("kO {x}"), Rule::Linganushasana(x) => format!("Li {x}"), - Rule::Unadi(x) => format!("uRA {x}"), + Rule::UP(x) => format!("uRA {x}"), } } @@ -179,77 +501,8 @@ pub fn assert_has_tinanta( vacana: Vacana, expected: &[&str], ) { - let args = TinantaArgs::builder() - .prayoga(Prayoga::Kartari) - .purusha(purusha) - .vacana(vacana) - .lakara(lakara) - .build() - .unwrap(); - let actual = derive_tinantas(&dhatu.clone().with_prefixes(prefixes), &args); - assert_padas(actual, expected); -} - -/// Checks parasmaipada + the given lakara/purusha/vacana -fn assert_has_parasmai_tinanta( - prefixes: &[&str], - dhatu: &Dhatu, - lakara: Lakara, - purusha: Purusha, - vacana: Vacana, - expected: &[&str], -) { - let args = TinantaArgs::builder() - .prayoga(Prayoga::Kartari) - .purusha(purusha) - .vacana(vacana) - .lakara(lakara) - .pada(Pada::Parasmai) - .build() - .unwrap(); - let actual = derive_tinantas(&dhatu.clone().with_prefixes(prefixes), &args); - assert_padas(actual, expected); -} - -/// Checks atmanepada + the given lakara/purusha/vacana -fn assert_has_atmane_tinanta( - prefixes: &[&str], - dhatu: &Dhatu, - lakara: Lakara, - purusha: Purusha, - vacana: Vacana, - expected: &[&str], -) { - let args = TinantaArgs::builder() - .prayoga(Prayoga::Kartari) - .purusha(purusha) - .vacana(vacana) - .lakara(lakara) - .pada(Pada::Atmane) - .build() - .unwrap(); - let actual = derive_tinantas(&dhatu.clone().with_prefixes(prefixes), &args); - assert_padas(actual, expected); -} - -/// Checks karmani + the given lakara/purusha/vacana -pub fn assert_has_karmani_tinanta( - prefixes: &[&str], - dhatu: &Dhatu, - lakara: Lakara, - purusha: Purusha, - vacana: Vacana, - expected: &[&str], -) { - let args = TinantaArgs::builder() - .prayoga(Prayoga::Karmani) - .purusha(purusha) - .vacana(vacana) - .lakara(lakara) - .build() - .unwrap(); - let actual = derive_tinantas(&dhatu.clone().with_prefixes(prefixes), &args); - assert_padas(actual, expected); + let t = Tester::default(); + t.assert_has_tin(prefixes, dhatu, lakara, purusha, vacana, expected); } pub fn assert_has_sandhi(first: &str, second: &str, expected: &[&str]) { @@ -354,306 +607,94 @@ pub fn dhatu_prati(text: &str) -> Pratipadika { .unwrap() } -// Tinanta helpers (based on final suffix) -// --------------------------------------- - -pub fn assert_has_tip(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Prathama, Eka, expected); -} - -pub fn assert_has_tas(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Prathama, Dvi, expected); -} - -pub fn assert_has_jhi(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Prathama, Bahu, expected); -} - -pub fn assert_has_sip(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Eka, expected); -} - -pub fn assert_has_thas(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Dvi, expected); -} - -pub fn assert_has_tha(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Bahu, expected); -} - -pub fn assert_has_mip(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Uttama, Eka, expected); -} - -pub fn assert_has_vas(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Uttama, Dvi, expected); -} - -pub fn assert_has_mas(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_parasmai_tinanta(prefixes, dhatu, la, Purusha::Uttama, Bahu, expected); -} - -pub fn assert_has_ta(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Prathama, Eka, expected); -} - -pub fn assert_has_aataam(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Prathama, Dvi, expected); -} - -pub fn assert_has_jha(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Prathama, Bahu, expected); -} - -pub fn assert_has_thaas(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Eka, expected); -} - -pub fn assert_has_aathaam(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Dvi, expected); -} - -pub fn assert_has_dhvam(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Bahu, expected); -} - -pub fn assert_has_iw(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Uttama, Eka, expected); -} - -pub fn assert_has_vahi(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Uttama, Dvi, expected); -} - -pub fn assert_has_mahin(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_atmane_tinanta(prefixes, dhatu, la, Purusha::Uttama, Bahu, expected); -} - -pub fn assert_has_ta_k(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Prathama, Eka, expected); -} - -pub fn assert_has_aataam_k(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Prathama, Dvi, expected); -} - -pub fn assert_has_jha_k(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Prathama, Bahu, expected); -} - -pub fn assert_has_thaas_k(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Eka, expected); -} - -pub fn assert_has_aathaam_karmani(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Dvi, expected); -} - -pub fn assert_has_dhvam_karmani(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Madhyama, Bahu, expected); -} - -pub fn assert_has_iw_k(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Uttama, Eka, expected); -} - -pub fn assert_has_vahi_karmani(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Uttama, Dvi, expected); -} - -pub fn assert_has_mahin_karmani(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { - assert_has_karmani_tinanta(prefixes, dhatu, la, Purusha::Uttama, Bahu, expected); -} - -// Tinanta helpers (based on lakara suffix) -// ---------------------------------------- - -pub fn assert_has_lat(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lat); - assert_padas(actual, expected); -} - -pub fn assert_has_lat_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lat, expected); -} - -pub fn assert_has_lat_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lat, expected); -} - -pub fn assert_has_lat_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lat); - assert_padas(actual, expected); -} - -pub fn assert_has_lit(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lit); - assert_padas(actual, expected); -} - -pub fn assert_has_lit_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lit, expected); -} - -pub fn assert_has_lit_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lit); - assert_padas(actual, expected); -} - -pub fn assert_has_lut(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lut); - assert_padas(actual, expected); -} - -pub fn assert_has_lut_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lut, expected); -} - -pub fn assert_has_lut_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lut); - assert_padas(actual, expected); -} - -pub fn assert_has_lrt(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lrt); - assert_padas(actual, expected); -} - -pub fn assert_has_lrt_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lrt, expected); -} - -pub fn assert_has_lrt_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lrt, expected); -} - -pub fn assert_has_lrt_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lrt); - assert_padas(actual, expected); -} - -pub fn assert_has_lot(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lot); - assert_padas(actual, expected); -} - -pub fn assert_has_lot_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lot, expected); -} - -pub fn assert_has_lot_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lot, expected); -} - -pub fn assert_has_lan(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lan); - assert_padas(actual, expected); -} - -pub fn assert_has_lan_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lan, expected); -} - -pub fn assert_has_lan_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lan, expected); -} - -pub fn assert_has_lan_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lan); - assert_padas(actual, expected); -} - -pub fn assert_has_ashirlin(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::AshirLin); - assert_padas(actual, expected); -} - -pub fn assert_has_ashirlin_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::AshirLin, expected); -} - -pub fn assert_has_ashirlin_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::AshirLin, expected); -} - -pub fn assert_has_ashirlin_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::AshirLin); - assert_padas(actual, expected); -} - -pub fn assert_has_vidhilin(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::VidhiLin); - assert_padas(actual, expected); -} - -pub fn assert_has_vidhilin_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::VidhiLin, expected); -} - -pub fn assert_has_vidhilin_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::VidhiLin, expected); -} - -pub fn assert_has_lun(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lun); - assert_padas(actual, expected); -} - -pub fn assert_has_lun_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lun, expected); -} - -pub fn assert_has_lun_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lun, expected); -} - -pub fn assert_has_lun_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lun); - assert_padas(actual, expected); -} - -pub fn assert_has_lrn(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_lakara(prefixes, dhatu, Lakara::Lrn); - assert_padas(actual, expected); -} - -pub fn assert_has_lrn_p(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_tip(prefixes, dhatu, Lakara::Lrn, expected); +/// Creates a function alias `fn_name` that points to the method of the same name on a default +/// `Tester` instance. +macro_rules! test_tin { + ($fn_name:ident) => { + pub fn $fn_name(prefixes: &[&str], dhatu: &Dhatu, la: Lakara, expected: &[&str]) { + let t = Tester::default(); + t.$fn_name(prefixes, dhatu, la, expected); + } + }; } -pub fn assert_has_lrn_a(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - assert_has_ta(prefixes, dhatu, Lakara::Lrn, expected); +test_tin!(assert_has_tip); +test_tin!(assert_has_tas); +test_tin!(assert_has_jhi); +test_tin!(assert_has_sip); +test_tin!(assert_has_thas); +test_tin!(assert_has_tha); +test_tin!(assert_has_mip); +test_tin!(assert_has_vas); +test_tin!(assert_has_mas); + +test_tin!(assert_has_ta); +test_tin!(assert_has_aataam); +test_tin!(assert_has_jha); +test_tin!(assert_has_thaas); +test_tin!(assert_has_aathaam); +test_tin!(assert_has_dhvam); +test_tin!(assert_has_iw); +test_tin!(assert_has_vahi); +test_tin!(assert_has_mahin); + +test_tin!(assert_has_ta_k); +test_tin!(assert_has_aataam_k); +test_tin!(assert_has_jha_k); +test_tin!(assert_has_thaas_k); +test_tin!(assert_has_aathaam_k); +test_tin!(assert_has_dhvam_k); +test_tin!(assert_has_iw_k); +test_tin!(assert_has_vahi_k); +test_tin!(assert_has_mahin_k); + +macro_rules! test_la { + ($fn_name:ident, $la:expr) => { + pub fn $fn_name(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { + let t = Tester::default(); + t.assert_has_lakara(prefixes, dhatu, $la, expected); + } + }; } -pub fn assert_has_lrn_karmani(prefixes: &[&str], dhatu: &Dhatu, expected: &[&str]) { - let actual = derive_karmani(prefixes, dhatu, Lakara::Lrn); - assert_padas(actual, expected); -} +test_la!(assert_has_lat, Lakara::Lat); +test_la!(assert_has_lit, Lakara::Lit); +test_la!(assert_has_lut, Lakara::Lut); +test_la!(assert_has_lrt, Lakara::Lrt); +test_la!(assert_has_lot, Lakara::Lot); +test_la!(assert_has_lan, Lakara::Lan); +test_la!(assert_has_ashirlin, Lakara::AshirLin); +test_la!(assert_has_vidhilin, Lakara::VidhiLin); +test_la!(assert_has_lun, Lakara::Lun); +test_la!(assert_has_lrn, Lakara::Lrn); // Krdanta helpers // --------------- -pub fn assert_has_krdanta(prefixes: &[&str], dhatu: &Dhatu, krt: Krt, expected: &[&str]) { - let args = KrdantaArgs::builder().krt(krt).build().unwrap(); - assert_padas( - derive_krdantas(&dhatu.clone().with_prefixes(prefixes), args), - expected, - ); +pub fn assert_has_krdanta( + prefixes: &[&str], + dhatu: &Dhatu, + krt: impl Into, + expected: &[&str], +) { + let t = Tester::default(); + t.assert_has_krt(prefixes, dhatu, krt, expected); } pub fn assert_has_artha_krdanta( upapadas: &[&str], dhatu: &Dhatu, requested_artha: KrtArtha, - krt: Krt, + krt: impl Into, expected: &[&str], ) { + let a = Ashtadhyayi::new(); let args = KrdantaArgs::builder() - .krt(krt) + .krt(krt.into()) .artha(requested_artha) .build() .unwrap(); - let mut prakriyas = derive_krdantas(&dhatu.clone().with_prefixes(upapadas), args); + let mut prakriyas = derive_krdantas(&a, &dhatu.clone().with_prefixes(upapadas), args); prakriyas.retain(|p| { if let Some(Artha::Krt(prakriya_artha)) = p.artha() { @@ -669,16 +710,17 @@ pub fn assert_has_upapada_krdanta( upapada: &str, prefixes: &[&str], dhatu: &Dhatu, - krt: Krt, + krt: impl Into, expected: &[&str], ) { + let a = Ashtadhyayi::new(); let args = KrdantaArgs::builder() - .krt(krt) + .krt(krt.into()) .upapada(Upapada::make_subanta(upapada)) .build() .unwrap(); assert_padas( - derive_krdantas(&dhatu.clone().with_prefixes(prefixes), args), + derive_krdantas(&a, &dhatu.clone().with_prefixes(prefixes), args), expected, ); } @@ -687,16 +729,17 @@ pub fn assert_has_upapada_krdanta_raw( upapada: Upapada, prefixes: &[&str], dhatu: &Dhatu, - krt: Krt, + krt: impl Into, expected: &[&str], ) { + let a = Ashtadhyayi::new(); let args = KrdantaArgs::builder() - .krt(krt) + .krt(krt.into()) .upapada(upapada) .build() .unwrap(); assert_padas( - derive_krdantas(&dhatu.clone().with_prefixes(prefixes), args), + derive_krdantas(&a, &dhatu.clone().with_prefixes(prefixes), args), expected, ); } @@ -729,24 +772,6 @@ pub fn assert_has_artha_taddhita( // Subanta helpers // --------------- -fn assert_has_subantas_p( - pratipadika: &Pratipadika, - linga: Linga, - vibhakti: Vibhakti, - vacana: Vacana, - expected: &[&str], -) { - let args = SubantaArgs::builder() - .linga(linga) - .vacana(vacana) - .vibhakti(vibhakti) - .build() - .unwrap(); - - let actual = derive_subantas(pratipadika, args); - assert_padas(actual, expected); -} - /// Like `assert_has_subantas_p` but without any filtering on the last sound. /// (Needed for 8.4.56.) pub fn assert_has_subantas_raw( @@ -788,98 +813,37 @@ impl Prati for &str { } } -pub fn assert_has_sup_1s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Prathama, Eka, &expected); -} - -pub fn assert_has_sup_1d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Prathama, Dvi, &expected); -} - -pub fn assert_has_sup_1p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Prathama, Bahu, &expected); -} - -pub fn assert_has_sup_2s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Dvitiya, Eka, &expected); -} - -pub fn assert_has_sup_2d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Dvitiya, Dvi, &expected); -} - -pub fn assert_has_sup_2p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Dvitiya, Bahu, &expected); -} - -pub fn assert_has_sup_3s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Trtiya, Eka, &expected); -} - -pub fn assert_has_sup_3d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Trtiya, Dvi, &expected); -} - -pub fn assert_has_sup_3p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Trtiya, Bahu, &expected); -} - -pub fn assert_has_sup_4s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Caturthi, Eka, &expected); -} - -pub fn assert_has_sup_4d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Caturthi, Dvi, &expected); -} - -pub fn assert_has_sup_4p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Caturthi, Bahu, &expected); -} - -pub fn assert_has_sup_5s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Panchami, Eka, &expected); -} - -pub fn assert_has_sup_5d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Panchami, Dvi, &expected); -} - -pub fn assert_has_sup_5p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Panchami, Bahu, &expected); -} - -pub fn assert_has_sup_6s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sasthi, Eka, &expected); -} - -pub fn assert_has_sup_6d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sasthi, Dvi, &expected); -} - -pub fn assert_has_sup_6p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sasthi, Bahu, &expected); -} - -pub fn assert_has_sup_7s(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Saptami, Eka, &expected); -} - -pub fn assert_has_sup_7d(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Saptami, Dvi, &expected); -} - -pub fn assert_has_sup_7p(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Saptami, Bahu, &expected); -} - -pub fn assert_has_sup_ss(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sambodhana, Eka, &expected); -} - -pub fn assert_has_sup_sd(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sambodhana, Dvi, &expected); +macro_rules! test_sup { + ($fn_name:ident, $vibhakti:expr, $vacana:expr) => { + pub fn $fn_name(prati: impl Prati, linga: Linga, expected: &[&str]) { + let t = Tester::default(); + t.assert_has_sup(&prati.to_p(), linga, $vibhakti, $vacana, &expected); + } + }; } -pub fn assert_has_sup_sp(prati: impl Prati, linga: Linga, expected: &[&str]) { - assert_has_subantas_p(&prati.to_p(), linga, Sambodhana, Bahu, &expected); -} +// TODO: move these to Tester. +test_sup!(assert_has_sup_1s, Prathama, Eka); +test_sup!(assert_has_sup_1d, Prathama, Dvi); +test_sup!(assert_has_sup_1p, Prathama, Bahu); +test_sup!(assert_has_sup_2s, Dvitiya, Eka); +test_sup!(assert_has_sup_2d, Dvitiya, Dvi); +test_sup!(assert_has_sup_2p, Dvitiya, Bahu); +test_sup!(assert_has_sup_3s, Trtiya, Eka); +test_sup!(assert_has_sup_3d, Trtiya, Dvi); +test_sup!(assert_has_sup_3p, Trtiya, Bahu); +test_sup!(assert_has_sup_4s, Caturthi, Eka); +test_sup!(assert_has_sup_4d, Caturthi, Dvi); +test_sup!(assert_has_sup_4p, Caturthi, Bahu); +test_sup!(assert_has_sup_5s, Panchami, Eka); +test_sup!(assert_has_sup_5d, Panchami, Dvi); +test_sup!(assert_has_sup_5p, Panchami, Bahu); +test_sup!(assert_has_sup_6s, Sasthi, Eka); +test_sup!(assert_has_sup_6d, Sasthi, Dvi); +test_sup!(assert_has_sup_6p, Sasthi, Bahu); +test_sup!(assert_has_sup_7s, Saptami, Eka); +test_sup!(assert_has_sup_7d, Saptami, Dvi); +test_sup!(assert_has_sup_7p, Saptami, Bahu); +test_sup!(assert_has_sup_ss, Sambodhana, Eka); +test_sup!(assert_has_sup_sd, Sambodhana, Dvi); +test_sup!(assert_has_sup_sp, Sambodhana, Bahu); diff --git a/vidyut-prakriya/tests/api.rs b/vidyut-prakriya/tests/api.rs index 16ff64a..a6d02c3 100644 --- a/vidyut-prakriya/tests/api.rs +++ b/vidyut-prakriya/tests/api.rs @@ -1,7 +1,10 @@ -/// Basic tests against our high-level API. These tests verify two important things: -/// -/// 1. That the API contract hasn't changed unexpectedly. -/// 2. That the function can handle pathological input without panicking. +/*! +Basic tests against our high-level API. These tests verify two important things: + +1. That the API contract hasn't changed unexpectedly. +2. That the function can handle pathological input without panicking. +*/ +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::*; use vidyut_prakriya::Ashtadhyayi; diff --git a/vidyut-prakriya/tests/basic_krdantas.rs b/vidyut-prakriya/tests/basic_krdantas.rs index f85eb11..28ebaab 100644 --- a/vidyut-prakriya/tests/basic_krdantas.rs +++ b/vidyut-prakriya/tests/basic_krdantas.rs @@ -6,11 +6,12 @@ the standard Sanskrit alphabetical order by the aupadeshika form of the krt prat Test cases marked with *Kale* are from M. R. Kale's *A Higher Sanskrit Grammar*. */ +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::*; use vidyut_prakriya::Ashtadhyayi; /// Creates a krdanta with the given args. -fn create_krdanta(dhatu: &str, gana: &str, krt: Krt) -> Vec { +fn create_krdanta(dhatu: &str, gana: &str, krt: BaseKrt) -> Vec { let a = Ashtadhyayi::new(); let dhatu = Dhatu::new(dhatu, gana.parse().expect("ok")); let args = KrdantaArgs::builder().krt(krt).build().unwrap(); @@ -20,7 +21,7 @@ fn create_krdanta(dhatu: &str, gana: &str, krt: Krt) -> Vec { } /// Tests all of the given test cases against the given krt-pratyaya. -fn test_krdanta(cases: &Vec<(&'static str, u8, &'static str)>, krt: Krt) { +fn test_krdanta(cases: &Vec<(&'static str, u8, &'static str)>, krt: BaseKrt) { let mut num_errors = 0; for (dhatu, gana, expected) in cases { let mut expected: Vec<_> = expected.split('|').collect(); diff --git a/vidyut-prakriya/tests/kashika_1_1.rs b/vidyut-prakriya/tests/kashika_1_1.rs index 2486651..4ee5ed6 100644 --- a/vidyut-prakriya/tests/kashika_1_1.rs +++ b/vidyut-prakriya/tests/kashika_1_1.rs @@ -1,12 +1,12 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; use vidyut_prakriya::args::Purusha as P; use vidyut_prakriya::args::Taddhita as T; use vidyut_prakriya::args::Vacana::*; -use vidyut_prakriya::args::*; #[test] fn sutra_1_1_1() { @@ -32,24 +32,24 @@ fn sutra_1_1_2() { #[test] fn sutra_1_1_3() { // guRa - assert_has_lat_p(&[], &d("tF", Bhvadi), &["tarati"]); - assert_has_lat_p(&[], &d("RI\\Y", Bhvadi), &["nayati"]); - assert_has_lat_p(&[], &d("BU", Bhvadi), &["Bavati"]); + assert_has_tip(&[], &d("tF", Bhvadi), Lat, &["tarati"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lat, &["nayati"]); + assert_has_tip(&[], &d("BU", Bhvadi), Lat, &["Bavati"]); // vfdDi - assert_has_lun_p(&[], &d("qukf\\Y", Tanadi), &["akArzIt"]); - assert_has_lun_p(&[], &d("hf\\Y", Bhvadi), &["ahArzIt"]); - assert_has_lun_p(&[], &d("ci\\Y", Svadi), &["acEzIt"]); - assert_has_lun_p(&[], &d("RI\\Y", Bhvadi), &["anEzIt"]); - assert_has_lun_p(&[], &d("lUY", Kryadi), &["alAvIt"]); - assert_has_lun_p(&[], &d("zwu\\Y", Adadi), &["astAvIt"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lun, &["akArzIt"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lun, &["ahArzIt"]); + assert_has_tip(&[], &d("ci\\Y", Svadi), Lun, &["acEzIt"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lun, &["anEzIt"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lun, &["alAvIt"]); + assert_has_tip(&[], &d("zwu\\Y", Adadi), Lun, &["astAvIt"]); // Other examples - assert_has_lat_p(&[], &d("YimidA~", Divadi), &["medyati"]); + assert_has_tip(&[], &d("YimidA~", Divadi), Lat, &["medyati"]); assert_has_jhi(&[], &d("YiBI\\", Juhotyadi), Lan, &["abiBayuH"]); // ikaH assert_has_krdanta(&[], &d("yA\\", Adadi), Krt::lyuw, &["yAna"]); - assert_has_lat_p(&[], &d("glE\\", Bhvadi), &["glAyati"]); + assert_has_tip(&[], &d("glE\\", Bhvadi), Lat, &["glAyati"]); assert_has_krdanta(&[], &d("unBa~", Tudadi), Krt::tfc, &["umBitf"]); // punargrahaNam of the terms "guna" and "vrddhi" @@ -74,11 +74,11 @@ fn sutra_1_1_4() { // TODO: ArdhadhAtuke? // ikaH - assert_has_lun_karmani(&[], &d("Ba\\njo~", Rudhadi), &["aBAji", "aBaYji"]); + assert_has_ta_k(&[], &d("Ba\\njo~", Rudhadi), Lun, &["aBAji", "aBaYji"]); assert_has_krdanta(&[], &d("ra\\nja~^", Divadi), Krt::GaY, &["rAga", "raNga"]); // bahuvrIhi? - assert_has_lat_p(&[], &nic(&d("knUyI~\\", Bhvadi)), &["knopayati"]); + assert_has_tip(&[], &nic(&d("knUyI~\\", Bhvadi)), Lat, &["knopayati"]); // TODO: preddha } @@ -133,6 +133,10 @@ fn sutra_1_1_6() { assert_has_lut(&[], &d("raRa~", Bhvadi), &["raRitA"]); } +// No examples available for these sutras. +#[test] +fn skip_sutra_1_1_7_to_sutra_1_1_8() {} + #[test] fn sutra_1_1_9() { let tfp = d("tf\\pa~", Divadi); @@ -150,7 +154,12 @@ fn sutra_1_1_10() { #[test] fn sutra_1_1_20() { - assert_has_lat_p(&["pra", "ni"], &d("qudA\\Y", Juhotyadi), &["praRidadAti"]); + assert_has_tip( + &["pra", "ni"], + &d("qudA\\Y", Juhotyadi), + Lat, + &["praRidadAti"], + ); assert_has_krdanta( &["pra", "ni"], &d("dA\\R", Bhvadi), @@ -159,8 +168,13 @@ fn sutra_1_1_20() { ); assert_has_lat(&["pra", "ni"], &d("do\\", Divadi), &["praRidyati"]); assert_has_lat(&["pra", "ni"], &d("de\\N", Bhvadi), &["praRidayate"]); - assert_has_lat_p(&["pra", "ni"], &d("quDA\\Y", Juhotyadi), &["praRidaDAti"]); - assert_has_lat_p(&["pra", "ni"], &d("De\\w", Bhvadi), &["praRiDayati"]); + assert_has_tip( + &["pra", "ni"], + &d("quDA\\Y", Juhotyadi), + Lat, + &["praRidaDAti"], + ); + assert_has_tip(&["pra", "ni"], &d("De\\w", Bhvadi), Lat, &["praRiDayati"]); // adAp assert_has_krdanta(&[], &d("dA\\p", Adadi), Krt::kta, &["dAta"]); assert_has_krdanta(&["ava"], &d("dE\\p", Bhvadi), Krt::kta, &["avadAta"]); @@ -344,8 +358,8 @@ fn sutra_1_1_46() { #[test] fn sutra_1_1_47() { - assert_has_lat_p(&["vi"], &d("ru\\Di~^r", Rudhadi), &["viruRadDi"]); - assert_has_lat_p(&[], &d("mu\\cx~^", Tudadi), &["muYcati"]); + assert_has_tip(&["vi"], &d("ru\\Di~^r", Rudhadi), Lat, &["viruRadDi"]); + assert_has_tip(&[], &d("mu\\cx~^", Tudadi), Lat, &["muYcati"]); assert_has_sup_1p("payas", Napumsaka, &["payAMsi"]); } @@ -434,15 +448,15 @@ fn sutra_1_1_56() { #[test] fn sutra_1_1_59() { let pai = d("pE\\", Bhvadi); - assert_has_tinanta(&[], &pai, Lit, P::Prathama, Dvi, &["papatuH"]); - assert_has_tinanta(&[], &pai, Lit, P::Prathama, Bahu, &["papuH"]); + assert_has_tas(&[], &pai, Lit, &["papatuH"]); + assert_has_jhi(&[], &pai, Lit, &["papuH"]); let han = d("ha\\na~", Adadi); - assert_has_tinanta(&[], &han, Lit, P::Prathama, Dvi, &["jaGnatuH"]); - assert_has_tinanta(&[], &han, Lit, P::Prathama, Bahu, &["jaGnuH"]); + assert_has_tas(&[], &han, Lit, &["jaGnatuH"]); + assert_has_jhi(&[], &han, Lit, &["jaGnuH"]); let aw = d("awa~", Bhvadi); - assert_has_lun_p(&[], &nic(&aw), &["Awiwat"]); + assert_has_tip(&[], &nic(&aw), Lun, &["Awiwat"]); let kf = d("qukf\\Y", Tanadi); assert_has_tas(&[], &kf, Lit, &["cakratuH"]); @@ -452,8 +466,8 @@ fn sutra_1_1_59() { assert_has_mip(&[], &d("lUY", Kryadi), Lit, &["lulava", "lulAva"]); // dvirvacane - assert_has_lit_karmani(&[], &d("glE\\", Bhvadi), &["jagle"]); - assert_has_lit_karmani(&[], &d("mlE\\", Bhvadi), &["mamle"]); + assert_has_ta_k(&[], &d("glE\\", Bhvadi), Lit, &["jagle"]); + assert_has_ta_k(&[], &d("mlE\\", Bhvadi), Lit, &["mamle"]); // dvirvacananimitte assert_has_lat(&[], &san(&d("divu~", Divadi)), &["didevizati", "dudyUzati"]); @@ -465,8 +479,8 @@ fn sutra_1_1_59() { #[test] fn sutra_1_1_61() { - assert_has_lat_p(&[], &d("a\\da~", Adadi), &["atti"]); - assert_has_lat_p(&[], &d("hu\\", Juhotyadi), &["juhoti"]); + assert_has_tip(&[], &d("a\\da~", Adadi), Lat, &["atti"]); + assert_has_tip(&[], &d("hu\\", Juhotyadi), Lat, &["juhoti"]); // TODO: lup } diff --git a/vidyut-prakriya/tests/kashika_1_2.rs b/vidyut-prakriya/tests/kashika_1_2.rs index e4e0f51..2f64106 100644 --- a/vidyut-prakriya/tests/kashika_1_2.rs +++ b/vidyut-prakriya/tests/kashika_1_2.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -7,7 +8,7 @@ use vidyut_prakriya::args::*; #[test] fn sutra_1_2_1() { - assert_has_lun_a(&["aDi"], &d("i\\N", Adadi), &["aDyagIzwa", "aDyEzwa"]); + assert_has_ta(&["aDi"], &d("i\\N", Adadi), Lun, &["aDyagIzwa", "aDyEzwa"]); let kuw = d("kuwa~", Tudadi).with_antargana(Some(Antargana::Kutadi)); assert_has_krdanta(&[], &kuw, Krt::tfc, &["kuwitf"]); @@ -20,8 +21,8 @@ fn sutra_1_2_1() { assert_has_krdanta(&["ud"], &puw, Krt::tavya, &["utpuwitavya"]); let kuw_nic = nic(&kuw); - assert_has_lat_p(&["ud"], &kuw_nic, &["utkowayati"]); - assert_has_lit_p(&["ud"], &kuw, &["uccukowa"]); + assert_has_tip(&["ud"], &kuw_nic, Lat, &["utkowayati"]); + assert_has_tip(&["ud"], &kuw, Lit, &["uccukowa"]); assert_has_krdanta(&["ud"], &kuw, Krt::Rvul, &["utkowaka"]); assert_has_krdanta(&["ud"], &kuw, Krt::GaY, &["utkowa"]); // TODO: varttika @@ -140,105 +141,110 @@ fn sutra_1_2_7() { fn sutra_1_2_8() { let rud = d("rudi~r", Adadi); assert_has_krdanta(&[], &rud, Krt::ktvA, &["ruditvA"]); - assert_has_lat_p(&[], &san(&rud), &["rurudizati"]); + assert_has_tip(&[], &san(&rud), Lat, &["rurudizati"]); let vid = d("vida~", Adadi); assert_has_krdanta(&[], &vid, Krt::ktvA, &["viditvA"]); - assert_has_lat_p(&[], &san(&vid), &["vividizati"]); + assert_has_tip(&[], &san(&vid), Lat, &["vividizati"]); let mus = d("muza~", Kryadi); assert_has_krdanta(&[], &mus, Krt::ktvA, &["muzitvA"]); - assert_has_lat_p(&[], &san(&mus), &["mumuzizati"]); + assert_has_tip(&[], &san(&mus), Lat, &["mumuzizati"]); let grah = d("graha~^", Kryadi); assert_has_krdanta(&[], &grah, Krt::ktvA, &["gfhItvA"]); - assert_has_lat_p(&[], &san(&grah), &["jiGfkzati"]); + assert_has_tip(&[], &san(&grah), Lat, &["jiGfkzati"]); let svap = d("Yizva\\pa~", Adadi); assert_has_krdanta(&[], &svap, Krt::ktvA, &["suptvA"]); - assert_has_lat_p(&[], &san(&svap), &["suzupsati"]); + assert_has_tip(&[], &san(&svap), Lat, &["suzupsati"]); let prach = d("pra\\Ca~", Tudadi); assert_has_krdanta(&[], &prach, Krt::ktvA, &["pfzwvA"]); - assert_has_lat_p(&[], &san(&prach), &["pipfcCizati"]); + assert_has_tip(&[], &san(&prach), Lat, &["pipfcCizati"]); } #[ignore] #[test] fn sutra_1_2_9() { - assert_has_lat_p(&[], &san(&d("ci\\Y", Svadi)), &["cicIzati", "cikIzati"]); - assert_has_lat_p(&[], &san(&d("zwu\\Y", Adadi)), &["tuzwUzati"]); - assert_has_lat_p(&[], &san(&d("qukf\\Y", Tanadi)), &["cikIrzati"]); - assert_has_lat_p(&[], &san(&d("pA\\", Bhvadi)), &["pipAsati"]); - assert_has_lat_p(&[], &san(&d("zWA\\", Bhvadi)), &["tizWAsati"]); - assert_has_lat_a(&[], &san(&d("SIN", Adadi)), &["SiSayizate"]); - assert_has_lat_p(&[], &san(&d("jYapa~", Curadi)), &["jYIpsati"]); + assert_has_tip( + &[], + &san(&d("ci\\Y", Svadi)), + Lat, + &["cicIzati", "cikIzati"], + ); + assert_has_tip(&[], &san(&d("zwu\\Y", Adadi)), Lat, &["tuzwUzati"]); + assert_has_tip(&[], &san(&d("qukf\\Y", Tanadi)), Lat, &["cikIrzati"]); + assert_has_tip(&[], &san(&d("pA\\", Bhvadi)), Lat, &["pipAsati"]); + assert_has_tip(&[], &san(&d("zWA\\", Bhvadi)), Lat, &["tizWAsati"]); + assert_has_ta(&[], &san(&d("SIN", Adadi)), Lat, &["SiSayizate"]); + assert_has_tip(&[], &san(&d("jYapa~", Curadi)), Lat, &["jYIpsati"]); } #[ignore] #[test] fn sutra_1_2_10() { - assert_has_lat_p(&[], &san(&d("Bi\\di~^r", Rudhadi)), &["biBitsati"]); - assert_has_lat_a(&[], &san(&d("bu\\Da~\\", Divadi)), &["buButsate"]); + assert_has_tip(&[], &san(&d("Bi\\di~^r", Rudhadi)), Lat, &["biBitsati"]); + assert_has_ta(&[], &san(&d("bu\\Da~\\", Divadi)), Lat, &["buButsate"]); // ikaH - assert_has_lat_a(&[], &san(&d("ya\\ja~^", Bhvadi)), &["yiyakzate"]); + assert_has_ta(&[], &san(&d("ya\\ja~^", Bhvadi)), Lat, &["yiyakzate"]); // Jal - assert_has_lat_a(&[], &san(&d("vftu~\\", Bhvadi)), &["vivartizate"]); + assert_has_ta(&[], &san(&d("vftu~\\", Bhvadi)), Lat, &["vivartizate"]); // danB also in scope - assert_has_lat_p(&[], &san(&d("danBu~", Svadi)), &["DIpsati", "Dipsati"]); + assert_has_tip(&[], &san(&d("danBu~", Svadi)), Lat, &["DIpsati", "Dipsati"]); } #[test] fn sutra_1_2_11() { let bhid = d("Bi\\di~^r", Rudhadi); let budh = d("bu\\Da~\\", Divadi); - assert_has_ashirlin_a(&[], &bhid, &["BitsIzwa"]); - assert_has_ashirlin_a(&[], &budh, &["ButsIzwa"]); + assert_has_ta(&[], &bhid, AshirLin, &["BitsIzwa"]); + assert_has_ta(&[], &budh, AshirLin, &["ButsIzwa"]); // sic - assert_has_lun_a(&[], &bhid, &["aBitta"]); - assert_has_lun_a(&[], &budh, &["abudDa", "aboDi"]); + assert_has_ta(&[], &bhid, Lun, &["aBitta"]); + assert_has_ta(&[], &budh, Lun, &["abudDa", "aboDi"]); // ikaH let yaj = d("ya\\ja~^", Bhvadi); - assert_has_ashirlin_a(&[], &yaj, &["yakzIzwa"]); - assert_has_lun_a(&[], &yaj, &["ayazwa"]); + assert_has_ta(&[], &yaj, AshirLin, &["yakzIzwa"]); + assert_has_ta(&[], &yaj, Lun, &["ayazwa"]); // Atmanepadezu - assert_has_lun_p(&[], &d("sf\\ja~", Tudadi), &["asrAkzIt"]); - assert_has_lun_p(&[], &d("df\\Si~r", Bhvadi), &["adrAkzIt", "adarSat"]); + assert_has_tip(&[], &d("sf\\ja~", Tudadi), Lun, &["asrAkzIt"]); + assert_has_tip(&[], &d("df\\Si~r", Bhvadi), Lun, &["adrAkzIt", "adarSat"]); // halantAt let ci = d("ci\\Y", Svadi); - assert_has_ashirlin_a(&[], &ci, &["cezIzwa"]); - assert_has_lun_a(&[], &ci, &["acezwa"]); + assert_has_ta(&[], &ci, AshirLin, &["cezIzwa"]); + assert_has_ta(&[], &ci, Lun, &["acezwa"]); // Jali let vft = d("vftu~\\", Bhvadi); - assert_has_ashirlin_a(&[], &vft, &["vartizIzwa"]); - assert_has_lun_a(&[], &vft, &["avartizwa"]); + assert_has_ta(&[], &vft, AshirLin, &["vartizIzwa"]); + assert_has_ta(&[], &vft, Lun, &["avartizwa"]); // liNsicO let dviz = d("dvi\\za~^", Adadi); assert_has_krdanta(&[], &dviz, Krt::tfc, &["dvezwf"]); - assert_has_lrt_a(&[], &dviz, &["dvekzyate"]); + assert_has_ta(&[], &dviz, Lrt, &["dvekzyate"]); } #[test] fn sutra_1_2_12() { let kf = d("qukf\\Y", Tanadi); let hf = d("hf\\Y", Bhvadi); - assert_has_ashirlin_a(&[], &kf, &["kfzIzwa"]); - assert_has_ashirlin_a(&[], &hf, &["hfzIzwa"]); + assert_has_ta(&[], &kf, AshirLin, &["kfzIzwa"]); + assert_has_ta(&[], &hf, AshirLin, &["hfzIzwa"]); // sicaH - assert_has_lun_a(&[], &kf, &["akfta"]); - assert_has_lun_a(&[], &hf, &["ahfta"]); + assert_has_ta(&[], &kf, Lun, &["akfta"]); + assert_has_ta(&[], &hf, Lun, &["ahfta"]); // Jali let vf = d("vfY", Svadi); - assert_has_ashirlin_a(&[], &vf, &["varizIzwa", "vfzIzwa"]); - assert_has_lun_a(&[], &vf, &["avarizwa", "avarIzwa", "avfta"]); + assert_has_ta(&[], &vf, AshirLin, &["varizIzwa", "vfzIzwa"]); + assert_has_ta(&[], &vf, Lun, &["avarizwa", "avarIzwa", "avfta"]); } #[test] fn sutra_1_2_13() { let gam = d("ga\\mx~", Bhvadi); - assert_has_ashirlin_a(&["sam"], &gam, &["saNgaMsIzwa", "saNgasIzwa"]); + assert_has_ta(&["sam"], &gam, AshirLin, &["saNgaMsIzwa", "saNgasIzwa"]); // sicaH - assert_has_lun_a(&["sam"], &gam, &["samagaMsta", "samagata"]); + assert_has_ta(&["sam"], &gam, Lun, &["samagaMsta", "samagata"]); } #[test] @@ -270,8 +276,8 @@ fn sutra_1_2_17() { assert_has_aataam(&["upa"], &stha, Lun, &["upAsTizAtAm"]); assert_has_jha(&["upa"], &stha, Lun, &["upAsTizata"]); - assert_has_lun_a(&[], &d("qudA\\Y", Juhotyadi), &["adita"]); - assert_has_lun_a(&[], &d("quDA\\Y", Juhotyadi), &["aDita"]); + assert_has_ta(&[], &d("qudA\\Y", Juhotyadi), Lun, &["adita"]); + assert_has_ta(&[], &d("quDA\\Y", Juhotyadi), Lun, &["aDita"]); } #[test] @@ -440,7 +446,7 @@ fn sutra_1_2_26() { // sew let bhuj = d("Bu\\ja~", Rudhadi); assert_has_krdanta(&[], &bhuj, Krt::ktvA, &["BuktvA"]); - assert_has_lat_a(&[], &san(&bhuj), &["buBukzate"]); + assert_has_ta(&[], &san(&bhuj), Lat, &["buBukzate"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_1_3.rs b/vidyut-prakriya/tests/kashika_1_3.rs index 7bf562e..8b05e3a 100644 --- a/vidyut-prakriya/tests/kashika_1_3.rs +++ b/vidyut-prakriya/tests/kashika_1_3.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -61,9 +62,9 @@ fn sutra_1_3_6() { assert_has_sup_1s("zaRqa", Pum, &["zaRqaH"]); assert_has_sup_1s("zaqika", Pum, &["zaqikaH"]); // AdiH - assert_has_krdanta(&[], &d("ava~", Bhvadi), Krt::wizac, &["aviza"]); + assert_has_krdanta(&[], &d("ava~", Bhvadi), Unadi::wizac, &["aviza"]); // TODO: right mah? - assert_has_krdanta(&[], &d("maha~", Bhvadi), Krt::wizac, &["mahiza"]); + assert_has_krdanta(&[], &d("maha~", Bhvadi), Unadi::wizac, &["mahiza"]); } #[test] @@ -92,8 +93,8 @@ fn sutra_1_3_8() { assert_has_krdanta(&[], &d("ci\\Y", Svadi), Krt::lyuw, &["cayana"]); assert_has_krdanta(&[], &d("ji\\", Bhvadi), Krt::lyuw, &["jayana"]); // Sa - assert_has_lat_p(&[], &d("BU", Bhvadi), &["Bavati"]); - assert_has_lat_p(&[], &d("qupa\\ca~^z", Bhvadi), &["pacati"]); + assert_has_tip(&[], &d("BU", Bhvadi), Lat, &["Bavati"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lat, &["pacati"]); // ka let bhuj = d("Bu\\ja~", Rudhadi); assert_has_krdanta(&[], &bhuj, Krt::kta, &["Bukta"]); @@ -143,12 +144,12 @@ fn sutra_1_3_12() { #[test] fn sutra_1_3_13() { - assert_has_lat_karmani(&[], &d("glE\\", Bhvadi), &["glAyate"]); - assert_has_lat_karmani(&[], &d("Yizva\\pa~", Adadi), &["supyate"]); - assert_has_lat_karmani(&[], &d("Asa~\\", Adadi), &["Asyate"]); - assert_has_lat_karmani(&[], &d("qukf\\Y", Tanadi), &["kriyate"]); - assert_has_lat_karmani(&[], &d("hf\\Y", Bhvadi), &["hriyate"]); - assert_has_lat_karmani(&[], &d("lUY", Kryadi), &["lUyate"]); + assert_has_ta_k(&[], &d("glE\\", Bhvadi), Lat, &["glAyate"]); + assert_has_ta_k(&[], &d("Yizva\\pa~", Adadi), Lat, &["supyate"]); + assert_has_ta_k(&[], &d("Asa~\\", Adadi), Lat, &["Asyate"]); + assert_has_ta_k(&[], &d("qukf\\Y", Tanadi), Lat, &["kriyate"]); + assert_has_ta_k(&[], &d("hf\\Y", Bhvadi), Lat, &["hriyate"]); + assert_has_ta_k(&[], &d("lUY", Kryadi), Lat, &["lUyate"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_1_4.rs b/vidyut-prakriya/tests/kashika_1_4.rs index 27f9972..f228894 100644 --- a/vidyut-prakriya/tests/kashika_1_4.rs +++ b/vidyut-prakriya/tests/kashika_1_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -96,8 +97,8 @@ fn sutra_1_4_8() { fn sutra_1_4_10() { assert_has_krdanta(&[], &d("Bi\\di~^r", Rudhadi), Krt::tfc, &["Bettf"]); assert_has_krdanta(&[], &d("Ci\\di~^r", Rudhadi), Krt::tfc, &["Cettf"]); - assert_has_lun_p(&[], &nic(&d("qukf\\Y", Tanadi)), &["acIkarat"]); - assert_has_lun_p(&[], &nic(&d("hf\\Y", Bhvadi)), &["ajIharat"]); + assert_has_tip(&[], &nic(&d("qukf\\Y", Tanadi)), Lun, &["acIkarat"]); + assert_has_tip(&[], &nic(&d("hf\\Y", Bhvadi)), Lun, &["ajIharat"]); } #[test] @@ -114,9 +115,9 @@ fn sutra_1_4_13() { let hf = d("hf\\Y", Bhvadi); assert_has_krdanta(&[], &kf, Krt::tfc, &["kartf"]); assert_has_krdanta(&[], &hf, Krt::tfc, &["hartf"]); - assert_has_lrt_p(&[], &kf, &["karizyati"]); - assert_has_lrt_p(&[], &hf, &["harizyati"]); - assert_has_lrn_p(&[], &kf, &["akarizyat"]); + assert_has_tip(&[], &kf, Lrt, &["karizyati"]); + assert_has_tip(&[], &hf, Lrt, &["harizyati"]); + assert_has_tip(&[], &kf, Lrn, &["akarizyat"]); assert_has_taddhitanta(&prati("upagu"), T::aR, &["Opagava"]); assert_has_taddhitanta(&prati("kapawu"), T::aR, &["kApawava"]); @@ -171,8 +172,8 @@ fn sutra_1_4_22() { #[test] fn sutra_1_4_59() { let ni = d("RI\\Y", Bhvadi); - assert_has_lat_p(&["pra"], &ni, &["praRayati"]); - assert_has_lat_p(&["pari"], &ni, &["pariRayati"]); + assert_has_tip(&["pra"], &ni, Lat, &["praRayati"]); + assert_has_tip(&["pari"], &ni, Lat, &["pariRayati"]); assert_has_krdanta(&["pra"], &ni, Krt::Rvul, &["praRAyaka"]); assert_has_krdanta(&["pari"], &ni, Krt::Rvul, &["pariRAyaka"]); } @@ -180,7 +181,7 @@ fn sutra_1_4_59() { #[test] fn sutra_1_4_80() { assert_has_lat(&["vi"], &d("liKa~", Tudadi), &["viliKati"]); - assert_has_lat_p(&["tiras"], &d("qukf\\Y", Tanadi), &["tiraskaroti"]); + assert_has_tip(&["tiras"], &d("qukf\\Y", Tanadi), Lat, &["tiraskaroti"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_2_4.rs b/vidyut-prakriya/tests/kashika_2_4.rs index 531329c..4025c6a 100644 --- a/vidyut-prakriya/tests/kashika_2_4.rs +++ b/vidyut-prakriya/tests/kashika_2_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Purusha::*; @@ -26,7 +27,7 @@ fn sutra_2_4_36() { assert_has_krdanta(&[], &ad, Krt::kta, &["jagDa", "jagdDa"]); assert_has_krdanta(&[], &ad, Krt::ktavatu, &["jagDavat", "jagdDavat"]); - assert_has_lat_karmani(&[], &ad, &["adyate"]); + assert_has_ta_k(&[], &ad, Lat, &["adyate"]); assert_has_krdanta(&[], &ad, Krt::tavya, &["attavya"]); // TODO: annam @@ -106,7 +107,7 @@ fn sutra_2_4_45() { assert_has_tas(&[], &i, Lun, &["agAtAm"]); assert_has_jhi(&[], &i, Lun, &["aguH"]); // karmani - assert_has_lun_karmani(&[], &i, &["agAyi"]); + assert_has_ta_k(&[], &i, Lun, &["agAyi"]); } #[test] @@ -295,9 +296,9 @@ fn sutra_2_4_57() { #[test] fn sutra_2_4_72() { - assert_has_lat_p(&[], &d("a\\da~", Adadi), &["atti"]); - assert_has_lat_p(&[], &d("ha\\na~", Adadi), &["hanti"]); - assert_has_lat_p(&[], &d("dvi\\za~^", Adadi), &["dvezwi"]); + assert_has_tip(&[], &d("a\\da~", Adadi), Lat, &["atti"]); + assert_has_tip(&[], &d("ha\\na~", Adadi), Lat, &["hanti"]); + assert_has_tip(&[], &d("dvi\\za~^", Adadi), Lat, &["dvezwi"]); } #[ignore] @@ -326,24 +327,24 @@ fn sutra_2_4_74() { #[test] fn sutra_2_4_75() { - assert_has_lat_p(&[], &d("hu\\", Juhotyadi), &["juhoti"]); - assert_has_lat_p(&[], &d("quBf\\Y", Juhotyadi), &["biBarti"]); - assert_has_lat_p(&[], &d("Ri\\ji~^r", Juhotyadi), &["nenekti"]); + assert_has_tip(&[], &d("hu\\", Juhotyadi), Lat, &["juhoti"]); + assert_has_tip(&[], &d("quBf\\Y", Juhotyadi), Lat, &["biBarti"]); + assert_has_tip(&[], &d("Ri\\ji~^r", Juhotyadi), Lat, &["nenekti"]); } #[test] fn sutra_2_4_77() { let i = &d("i\\R", Adadi); - assert_has_lun_p(&[], &i, &["agAt"]); - assert_has_lun_p(&[], &d("zWA\\", Bhvadi), &["asTAt"]); - assert_has_lun_p(&[], &d("qudA\\Y", Juhotyadi), &["adAt"]); - assert_has_lun_p(&[], &d("quDA\\Y", Juhotyadi), &["aDAt"]); - assert_has_lun_p(&[], &d("pA\\", Bhvadi), &["apAt"]); - assert_has_lun_p(&[], &d("BU", Bhvadi), &["aBUt"]); + assert_has_tip(&[], &i, Lun, &["agAt"]); + assert_has_tip(&[], &d("zWA\\", Bhvadi), Lun, &["asTAt"]); + assert_has_tip(&[], &d("qudA\\Y", Juhotyadi), Lun, &["adAt"]); + assert_has_tip(&[], &d("quDA\\Y", Juhotyadi), Lun, &["aDAt"]); + assert_has_tip(&[], &d("pA\\", Bhvadi), Lun, &["apAt"]); + assert_has_tip(&[], &d("BU", Bhvadi), Lun, &["aBUt"]); // But, not gAyati or pAti - assert_has_lun_p(&[], &d("gE\\", Bhvadi), &["agAsIt"]); - assert_has_lun_p(&[], &d("pA\\", Adadi), &["apAsIt"]); + assert_has_tip(&[], &d("gE\\", Bhvadi), Lun, &["agAsIt"]); + assert_has_tip(&[], &d("pA\\", Adadi), Lun, &["apAsIt"]); // TODO: parasmEpadezu // assert_has_karmani_tinanta(&[], &i, Lun, Prathama, Dvi, &["agAsAtAm"]); @@ -351,11 +352,11 @@ fn sutra_2_4_77() { #[test] fn sutra_2_4_78() { - assert_has_lun_p(&[], &d("GrA\\", Bhvadi), &["aGrAt", "aGrAsIt"]); - assert_has_lun_p(&[], &d("De\\w", Bhvadi), &["aDAt", "aDAsIt", "adaDat"]); - assert_has_lun_p(&[], &d("So\\", Divadi), &["aSAt", "aSAsIt"]); - assert_has_lun_p(&[], &d("Co\\", Divadi), &["acCAt", "acCAsIt"]); - assert_has_lun_p(&[], &d("zo\\", Divadi), &["asAt", "asAsIt"]); + assert_has_tip(&[], &d("GrA\\", Bhvadi), Lun, &["aGrAt", "aGrAsIt"]); + assert_has_tip(&[], &d("De\\w", Bhvadi), Lun, &["aDAt", "aDAsIt", "adaDat"]); + assert_has_tip(&[], &d("So\\", Divadi), Lun, &["aSAt", "aSAsIt"]); + assert_has_tip(&[], &d("Co\\", Divadi), Lun, &["acCAt", "acCAsIt"]); + assert_has_tip(&[], &d("zo\\", Divadi), Lun, &["asAt", "asAsIt"]); // TODO: parasmEpadezu } diff --git a/vidyut-prakriya/tests/kashika_3_1.rs b/vidyut-prakriya/tests/kashika_3_1.rs index c0af11e..c82b3e1 100644 --- a/vidyut-prakriya/tests/kashika_3_1.rs +++ b/vidyut-prakriya/tests/kashika_3_1.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::*; @@ -29,8 +30,8 @@ fn sutra_3_1_5() { fn sutra_3_1_6() { assert_has_lat(&[], &d("mAna~\\", Bhvadi), &["mImAMsate"]); assert_has_lat(&[], &d("baDa~\\", Bhvadi), &["bIBatsate"]); - assert_has_lat_a(&[], &d("dAna~^", Bhvadi), &["dIdAMsate"]); - assert_has_lat_a(&[], &d("SAna~^", Bhvadi), &["SISAMsate"]); + assert_has_ta(&[], &d("dAna~^", Bhvadi), Lat, &["dIdAMsate"]); + assert_has_ta(&[], &d("SAna~^", Bhvadi), Lat, &["SISAMsate"]); // TODO: mAnayati, etc. } @@ -41,12 +42,17 @@ fn sutra_3_1_7() { let kf = san_d("qukf\\Y", Tanadi); let hf = san_d("hf\\Y", Bhvadi); - assert_has_lat_p(&[], &kf, &["cikIrzati"]); - assert_has_lat_p(&[], &hf, &["jihIrzati"]); - assert_has_lan_p(&["pra"], &kf, &["prAcikIrzat"]); + assert_has_tip(&[], &kf, Lat, &["cikIrzati"]); + assert_has_tip(&[], &hf, Lat, &["jihIrzati"]); + assert_has_tip(&["pra"], &kf, Lan, &["prAcikIrzat"]); - assert_has_lat_p(&[], &san_d("patx~", Bhvadi), &["pipatizati", "pitsati"]); - assert_has_lat_p(&[], &san_d("mf\\N", Tudadi), &["mumUrzati"]); + assert_has_tip( + &[], + &san_d("patx~", Bhvadi), + Lat, + &["pipatizati", "pitsati"], + ); + assert_has_tip(&[], &san_d("mf\\N", Tudadi), Lat, &["mumUrzati"]); } #[test] @@ -88,15 +94,15 @@ fn sutra_3_1_24() { #[test] fn sutra_3_1_25() { - assert_has_lat_p(&[], &d("cura~", Curadi), &["corayati"]); - assert_has_lat_p(&[], &d("citi~", Curadi), &["cintayati"]); + assert_has_tip(&[], &d("cura~", Curadi), Lat, &["corayati"]); + assert_has_tip(&[], &d("citi~", Curadi), Lat, &["cintayati"]); } #[test] fn sutra_3_1_26() { let san = |u, gana| d(u, gana).with_sanadi(&[Sanadi::Nic]); - assert_has_lat_p(&[], &san("qukf\\Y", Tanadi), &["kArayati"]); - assert_has_lat_p(&[], &san("qupa\\ca~^z", Bhvadi), &["pAcayati"]); + assert_has_tip(&[], &san("qukf\\Y", Tanadi), Lat, &["kArayati"]); + assert_has_tip(&[], &san("qupa\\ca~^z", Bhvadi), Lat, &["pAcayati"]); // TODO: add others } @@ -104,22 +110,22 @@ fn sutra_3_1_26() { #[test] fn sutra_3_1_28() { let pan = &d("paRa~\\", Bhvadi); - assert_has_lat_p(&[], &d("gupU~", Bhvadi), &["gopAyati"]); - assert_has_lat_p(&[], &d("DUpa~", Bhvadi), &["DUpAyati"]); - assert_has_lat_p(&[], &d("viCa~", Tudadi), &["vicCAyati"]); - assert_has_lat_p(&[], &pan, &["paRAyati"]); - assert_has_lat_p(&[], &d("pana~\\", Bhvadi), &["panAyati"]); - assert_has_lat_a(&[], &pan, &["paRate"]); + assert_has_tip(&[], &d("gupU~", Bhvadi), Lat, &["gopAyati"]); + assert_has_tip(&[], &d("DUpa~", Bhvadi), Lat, &["DUpAyati"]); + assert_has_tip(&[], &d("viCa~", Tudadi), Lat, &["vicCAyati"]); + assert_has_tip(&[], &pan, Lat, &["paRAyati"]); + assert_has_tip(&[], &d("pana~\\", Bhvadi), Lat, &["panAyati"]); + assert_has_ta(&[], &pan, Lat, &["paRate"]); } #[test] fn sutra_3_1_29() { - assert_has_lat_a(&[], &d("fti", Bhvadi), &["ftIyate"]); + assert_has_ta(&[], &d("fti", Bhvadi), Lat, &["ftIyate"]); } #[test] fn sutra_3_1_30() { - assert_has_lat_a(&[], &d("kamu~\\", Bhvadi), &["kAmayate"]); + assert_has_ta(&[], &d("kamu~\\", Bhvadi), Lat, &["kAmayate"]); } #[test] @@ -135,8 +141,8 @@ fn sutra_3_1_31() { #[test] fn sutra_3_1_33() { let kf = d("qukf\\Y", Tanadi); - assert_has_lrt_p(&[], &kf, &["karizyati"]); - assert_has_lrn_p(&[], &kf, &["akarizyat"]); + assert_has_tip(&[], &kf, Lrt, &["karizyati"]); + assert_has_tip(&[], &kf, Lrn, &["akarizyat"]); assert_has_lut(&[], &kf, &["kartA"]); assert_has_lut(&[], &d("ma\\na~\\", Divadi), &["mantA"]); assert_has_lut(&["sam"], &d("ga\\mx~", Bhvadi), &["saNgantA"]); @@ -282,78 +288,89 @@ fn sutra_3_1_41() { #[test] fn sutra_3_1_44() { - assert_has_lun_p(&[], &d("qukf\\Y", Tanadi), &["akArzIt"]); - assert_has_lun_p(&[], &d("hf\\Y", Bhvadi), &["ahArzIt"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lun, &["akArzIt"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lun, &["ahArzIt"]); } #[test] fn sutra_3_1_44_v1() { - assert_has_lun_p( + assert_has_tip( &[], &d("spf\\Sa~", Tudadi), + Lun, &["asprAkzIt", "aspArkzIt", "aspfkzat"], ); - assert_has_lun_p( + assert_has_tip( &[], &d("mf\\Sa~", Tudadi), + Lun, &["amrAkzIt", "amArkzIt", "amfkzat"], ); - assert_has_lun_p( + assert_has_tip( &[], &d("kf\\za~", Bhvadi), + Lun, &["akArkzIt", "akrAkzIt", "akfkzat"], ); - assert_has_lun_p( + assert_has_tip( &[], &d("tf\\pa~", Divadi), + Lun, &["atrApsIt", "atArpsIt", "atfpat", "atarpIt"], ); - assert_has_lun_p( + assert_has_tip( &[], &d("df\\pa~", Divadi), + Lun, &["adrApsIt", "adArpsIt", "adfpat", "adarpIt"], ); } #[test] fn sutra_3_1_45() { - assert_has_lun_p(&[], &d("du\\ha~^", Adadi), &["aDukzat"]); - assert_has_lun_p(&[], &d("li\\ha~^", Adadi), &["alikzat"]); + assert_has_tip(&[], &d("du\\ha~^", Adadi), Lun, &["aDukzat"]); + assert_has_tip(&[], &d("li\\ha~^", Adadi), Lun, &["alikzat"]); // SalaH - assert_has_lun_p(&[], &d("Bi\\di~^r", Rudhadi), &["aBEtsIt", "aBidat"]); - assert_has_lun_p(&[], &d("Ci\\di~^r", Rudhadi), &["acCEtsIt", "acCidat"]); + assert_has_tip(&[], &d("Bi\\di~^r", Rudhadi), Lun, &["aBEtsIt", "aBidat"]); + assert_has_tip(&[], &d("Ci\\di~^r", Rudhadi), Lun, &["acCEtsIt", "acCidat"]); // igupaDAt - assert_has_lun_p(&[], &d("da\\ha~", Bhvadi), &["aDAkzIt"]); + assert_has_tip(&[], &d("da\\ha~", Bhvadi), Lun, &["aDAkzIt"]); // aniwaH - assert_has_lun_p(&[], &d("kuza~", Kryadi), &["akozIt"]); - assert_has_lun_p(&[], &d("muza~", Kryadi), &["amozIt"]); + assert_has_tip(&[], &d("kuza~", Kryadi), Lun, &["akozIt"]); + assert_has_tip(&[], &d("muza~", Kryadi), Lun, &["amozIt"]); } #[test] fn sutra_3_1_46() { - assert_has_lun_p(&["AN"], &d("Sli\\za~", Divadi), &["ASlikzat", "ASlizat"]); + assert_has_tip( + &["AN"], + &d("Sli\\za~", Divadi), + Lun, + &["ASlikzat", "ASlizat"], + ); } #[test] fn sutra_3_1_47() { - assert_has_lun_p(&[], &d("df\\Si~r", Bhvadi), &["adarSat", "adrAkzIt"]); + assert_has_tip(&[], &d("df\\Si~r", Bhvadi), Lun, &["adarSat", "adrAkzIt"]); } #[test] fn sutra_3_1_48() { - assert_has_lun_p(&[], &nic(&d("qukf\\Y", Tanadi)), &["acIkarat"]); - assert_has_lun_p(&[], &nic(&d("hf\\Y", Bhvadi)), &["ajIharat"]); - assert_has_lun_p(&[], &d("SriY", Bhvadi), &["aSiSriyat"]); - assert_has_lun_p(&[], &d("dru\\", Bhvadi), &["adudruvat"]); - assert_has_lun_p(&[], &d("sru\\", Bhvadi), &["asusruvat"]); + assert_has_tip(&[], &nic(&d("qukf\\Y", Tanadi)), Lun, &["acIkarat"]); + assert_has_tip(&[], &nic(&d("hf\\Y", Bhvadi)), Lun, &["ajIharat"]); + assert_has_tip(&[], &d("SriY", Bhvadi), Lun, &["aSiSriyat"]); + assert_has_tip(&[], &d("dru\\", Bhvadi), Lun, &["adudruvat"]); + assert_has_tip(&[], &d("sru\\", Bhvadi), Lun, &["asusruvat"]); } #[test] fn sutra_3_1_49() { - assert_has_lun_p(&[], &d("De\\w", Bhvadi), &["adaDat", "aDAt", "aDAsIt"]); - assert_has_lun_p( + assert_has_tip(&[], &d("De\\w", Bhvadi), Lun, &["adaDat", "aDAt", "aDAsIt"]); + assert_has_tip( &[], &d("wuo~Svi", Bhvadi), + Lun, &["aSiSviyat", "aSvat", "aSvayIt"], ); } @@ -378,59 +395,60 @@ fn sutra_3_1_52() { #[test] fn sutra_3_1_53() { - assert_has_lun_p(&[], &d("li\\pa~^", Tudadi), &["alipat"]); - assert_has_lun_p(&[], &d("zi\\ca~^", Tudadi), &["asicat"]); - assert_has_lun_p(&[], &d("hve\\Y", Bhvadi), &["ahvat"]); + assert_has_tip(&[], &d("li\\pa~^", Tudadi), Lun, &["alipat"]); + assert_has_tip(&[], &d("zi\\ca~^", Tudadi), Lun, &["asicat"]); + assert_has_tip(&[], &d("hve\\Y", Bhvadi), Lun, &["ahvat"]); } #[test] fn sutra_3_1_54() { - assert_has_lun_a(&[], &d("li\\pa~^", Tudadi), &["alipata", "alipta"]); - assert_has_lun_a(&[], &d("zi\\ca~^", Tudadi), &["asicata", "asikta"]); - assert_has_lun_a(&[], &d("hve\\Y", Bhvadi), &["ahvata", "ahvAsta"]); + assert_has_ta(&[], &d("li\\pa~^", Tudadi), Lun, &["alipata", "alipta"]); + assert_has_ta(&[], &d("zi\\ca~^", Tudadi), Lun, &["asicata", "asikta"]); + assert_has_ta(&[], &d("hve\\Y", Bhvadi), Lun, &["ahvata", "ahvAsta"]); } #[test] fn sutra_3_1_55() { - assert_has_lun_p(&[], &d("pu\\za~", Divadi), &["apuzat"]); - assert_has_lun_p(&[], &d("dyuta~\\", Bhvadi), &["adyutat"]); - assert_has_lun_p(&[], &d("SvitA~\\", Bhvadi), &["aSvitat"]); - assert_has_lun_p(&[], &d("ga\\mx~", Bhvadi), &["agamat"]); - assert_has_lun_p(&[], &d("Sa\\kx~", Svadi), &["aSakat"]); + assert_has_tip(&[], &d("pu\\za~", Divadi), Lun, &["apuzat"]); + assert_has_tip(&[], &d("dyuta~\\", Bhvadi), Lun, &["adyutat"]); + assert_has_tip(&[], &d("SvitA~\\", Bhvadi), Lun, &["aSvitat"]); + assert_has_tip(&[], &d("ga\\mx~", Bhvadi), Lun, &["agamat"]); + assert_has_tip(&[], &d("Sa\\kx~", Svadi), Lun, &["aSakat"]); // parasmEpadezu - assert_has_lun_a(&["vi"], &d("dyuta~\\", Bhvadi), &["vyadyotizwa"]); - assert_has_lun_a(&[], &d("luwa~\\", Bhvadi), &["alowizwa"]); + assert_has_ta(&["vi"], &d("dyuta~\\", Bhvadi), Lun, &["vyadyotizwa"]); + assert_has_ta(&[], &d("luwa~\\", Bhvadi), Lun, &["alowizwa"]); } #[test] fn sutra_3_1_56() { - assert_has_lun_p(&[], &d("sf\\", Juhotyadi), &["asarat"]); - assert_has_lun_p(&[], &d("SAsu~", Adadi), &["aSizat"]); - assert_has_lun_p(&[], &d("f\\", Juhotyadi), &["Arat"]); - assert_has_lun_a(&["sam"], &d("f\\", Juhotyadi), &["samArata"]); + assert_has_tip(&[], &d("sf\\", Juhotyadi), Lun, &["asarat"]); + assert_has_tip(&[], &d("SAsu~", Adadi), Lun, &["aSizat"]); + assert_has_tip(&[], &d("f\\", Juhotyadi), Lun, &["Arat"]); + assert_has_ta(&["sam"], &d("f\\", Juhotyadi), Lun, &["samArata"]); } #[test] fn sutra_3_1_57() { - assert_has_lun_p(&[], &d("Bi\\di~^r", Rudhadi), &["aBidat", "aBEtsIt"]); - assert_has_lun_p(&[], &d("Ci\\di~^r", Rudhadi), &["acCidat", "acCEtsIt"]); + assert_has_tip(&[], &d("Bi\\di~^r", Rudhadi), Lun, &["aBidat", "aBEtsIt"]); + assert_has_tip(&[], &d("Ci\\di~^r", Rudhadi), Lun, &["acCidat", "acCEtsIt"]); // parasmEpadezu - assert_has_lun_a(&[], &d("Bi\\di~^r", Rudhadi), &["aBitta"]); - assert_has_lun_a(&[], &d("Ci\\di~^r", Rudhadi), &["acCitta"]); + assert_has_ta(&[], &d("Bi\\di~^r", Rudhadi), Lun, &["aBitta"]); + assert_has_ta(&[], &d("Ci\\di~^r", Rudhadi), Lun, &["acCitta"]); } #[test] fn sutra_3_1_58() { - assert_has_lun_p(&[], &d("jF", Kryadi), &["ajarat", "ajArIt"]); - assert_has_lun_p(&[], &d("stanBu~", Kryadi), &["astaBat", "astamBIt"]); - assert_has_lun_p(&[], &d("mrucu~", Bhvadi), &["amrucat", "amrocIt"]); - assert_has_lun_p(&[], &d("mlucu~", Bhvadi), &["amlucat", "amlocIt"]); - assert_has_lun_p(&[], &d("grucu~", Bhvadi), &["agrucat", "agrocIt"]); - assert_has_lun_p(&[], &d("glucu~", Bhvadi), &["aglucat", "aglocIt"]); - assert_has_lun_p(&[], &d("gluncu~", Bhvadi), &["aglucat", "agluYcIt"]); - assert_has_lun_p( + assert_has_tip(&[], &d("jF", Kryadi), Lun, &["ajarat", "ajArIt"]); + assert_has_tip(&[], &d("stanBu~", Kryadi), Lun, &["astaBat", "astamBIt"]); + assert_has_tip(&[], &d("mrucu~", Bhvadi), Lun, &["amrucat", "amrocIt"]); + assert_has_tip(&[], &d("mlucu~", Bhvadi), Lun, &["amlucat", "amlocIt"]); + assert_has_tip(&[], &d("grucu~", Bhvadi), Lun, &["agrucat", "agrocIt"]); + assert_has_tip(&[], &d("glucu~", Bhvadi), Lun, &["aglucat", "aglocIt"]); + assert_has_tip(&[], &d("gluncu~", Bhvadi), Lun, &["aglucat", "agluYcIt"]); + assert_has_tip( &[], &d("wuo~Svi", Bhvadi), + Lun, &["aSvat", "aSvayIt", "aSiSviyat"], ); } @@ -447,28 +465,28 @@ fn sutra_3_1_60() { #[test] fn sutra_3_1_61() { - assert_has_lun_karmani(&[], &d("dIpI~\\", Divadi), &["adIpi", "adIpizwa"]); - assert_has_lun_karmani(&[], &d("janI~\\", Divadi), &["ajani", "ajanizwa"]); - assert_has_lun_karmani(&[], &d("buDa~", Bhvadi), &["aboDi", "aboDizwa"]); - assert_has_lun_karmani(&[], &d("pUrI~\\", Divadi), &["apUri", "apUrizwa"]); - assert_has_lun_karmani(&[], &d("tAyf~\\", Bhvadi), &["atAyi", "atAyizwa"]); - assert_has_lun_karmani(&[], &d("o~pyAyI~\\", Bhvadi), &["apyAyi", "apyAyizwa"]); + assert_has_ta_k(&[], &d("dIpI~\\", Divadi), Lun, &["adIpi", "adIpizwa"]); + assert_has_ta_k(&[], &d("janI~\\", Divadi), Lun, &["ajani", "ajanizwa"]); + assert_has_ta_k(&[], &d("buDa~", Bhvadi), Lun, &["aboDi", "aboDizwa"]); + assert_has_ta_k(&[], &d("pUrI~\\", Divadi), Lun, &["apUri", "apUrizwa"]); + assert_has_ta_k(&[], &d("tAyf~\\", Bhvadi), Lun, &["atAyi", "atAyizwa"]); + assert_has_ta_k(&[], &d("o~pyAyI~\\", Bhvadi), Lun, &["apyAyi", "apyAyizwa"]); } #[test] fn sutra_3_1_66() { - assert_has_lun_karmani(&[], &d("SE\\", Bhvadi), &["aSAyi"]); - assert_has_lun_karmani(&[], &d("qukf\\Y", Tanadi), &["akAri"]); - assert_has_lun_karmani(&[], &d("hf\\Y", Bhvadi), &["ahAri"]); + assert_has_ta_k(&[], &d("SE\\", Bhvadi), Lun, &["aSAyi"]); + assert_has_ta_k(&[], &d("qukf\\Y", Tanadi), Lun, &["akAri"]); + assert_has_ta_k(&[], &d("hf\\Y", Bhvadi), Lun, &["ahAri"]); } #[test] fn sutra_3_1_67() { - assert_has_lat_karmani(&[], &d("Asa~\\", Adadi), &["Asyate"]); - assert_has_lat_karmani(&[], &d("SIN", Adadi), &["Sayyate"]); - assert_has_lat_karmani(&[], &d("qukf\\Y", Tanadi), &["kriyate"]); - assert_has_lat_karmani(&[], &d("ga\\mx~", Bhvadi), &["gamyate"]); - assert_has_lat_karmani(&[], &d("qupa\\ca~^z", Bhvadi), &["pacyate"]); + assert_has_ta_k(&[], &d("Asa~\\", Adadi), Lat, &["Asyate"]); + assert_has_ta_k(&[], &d("SIN", Adadi), Lat, &["Sayyate"]); + assert_has_ta_k(&[], &d("qukf\\Y", Tanadi), Lat, &["kriyate"]); + assert_has_ta_k(&[], &d("ga\\mx~", Bhvadi), Lat, &["gamyate"]); + assert_has_ta_k(&[], &d("qupa\\ca~^z", Bhvadi), Lat, &["pacyate"]); } #[test] @@ -488,11 +506,11 @@ fn sutra_3_1_70() { assert_has_lat(&[], &d("wuBrASf~\\", Bhvadi), &["BrASyate", "BrASate"]); assert_has_lat(&[], &d("wuBlASf~\\", Bhvadi), &["BlASyate", "BlASate"]); assert_has_lat(&[], &d("Bramu~", Divadi), &["BrAmyati", "Bramati"]); - assert_has_lat_p(&[], &d("kramu~", Bhvadi), &["krAmyati", "krAmati"]); + assert_has_tip(&[], &d("kramu~", Bhvadi), Lat, &["krAmyati", "krAmati"]); assert_has_lat(&[], &d("klamu~", Divadi), &["klAmyati", "klAmati"]); assert_has_lat(&[], &d("trasI~", Divadi), &["trasyati", "trasati"]); assert_has_lat(&[], &d("truwa~", Tudadi), &["truwyati", "truwati"]); - assert_has_lat_p(&[], &d("laza~^", Bhvadi), &["lazyati", "lazati"]); + assert_has_tip(&[], &d("laza~^", Bhvadi), Lat, &["lazyati", "lazati"]); } #[test] @@ -511,45 +529,45 @@ fn sutra_3_1_72() { #[test] fn sutra_3_1_73() { - assert_has_lat_p(&[], &d("zu\\Y", Svadi), &["sunoti"]); - assert_has_lat_p(&[], &d("zi\\Y", Svadi), &["sinoti"]); + assert_has_tip(&[], &d("zu\\Y", Svadi), Lat, &["sunoti"]); + assert_has_tip(&[], &d("zi\\Y", Svadi), Lat, &["sinoti"]); } #[test] fn sutra_3_1_74() { - assert_has_lat_p(&[], &d("Sru\\", Bhvadi), &["SfRoti"]); + assert_has_tip(&[], &d("Sru\\", Bhvadi), Lat, &["SfRoti"]); } #[test] fn sutra_3_1_75() { - assert_has_lat_p(&[], &d("akzU~", Bhvadi), &["akzRoti", "akzati"]); + assert_has_tip(&[], &d("akzU~", Bhvadi), Lat, &["akzRoti", "akzati"]); } #[test] fn sutra_3_1_76() { - assert_has_lat_p(&[], &d("takzU~", Bhvadi), &["takzRoti", "takzati"]); + assert_has_tip(&[], &d("takzU~", Bhvadi), Lat, &["takzRoti", "takzati"]); } #[test] fn sutra_3_1_77() { - assert_has_lat_p(&[], &d("tu\\da~^", Tudadi), &["tudati"]); - assert_has_lat_p(&[], &d("Ru\\da~^", Tudadi), &["nudati"]); + assert_has_tip(&[], &d("tu\\da~^", Tudadi), Lat, &["tudati"]); + assert_has_tip(&[], &d("Ru\\da~^", Tudadi), Lat, &["nudati"]); } #[test] fn sutra_3_1_78() { - assert_has_lat_p(&[], &d("ru\\Di~^r", Rudhadi), &["ruRadDi"]); - assert_has_lat_p(&[], &d("Bi\\di~^r", Rudhadi), &["Binatti"]); + assert_has_tip(&[], &d("ru\\Di~^r", Rudhadi), Lat, &["ruRadDi"]); + assert_has_tip(&[], &d("Bi\\di~^r", Rudhadi), Lat, &["Binatti"]); } #[test] fn sutra_3_1_79() { - assert_has_lat_p(&[], &d("tanu~^", Tanadi), &["tanoti"]); - assert_has_lat_p(&[], &d("zaRu~^", Tanadi), &["sanoti"]); - assert_has_lat_p(&[], &d("kzaRu~^", Tanadi), &["kzaRoti"]); - assert_has_lat_p(&[], &d("qukf\\Y", Tanadi), &["karoti"]); + assert_has_tip(&[], &d("tanu~^", Tanadi), Lat, &["tanoti"]); + assert_has_tip(&[], &d("zaRu~^", Tanadi), Lat, &["sanoti"]); + assert_has_tip(&[], &d("kzaRu~^", Tanadi), Lat, &["kzaRoti"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lat, &["karoti"]); - assert_has_lun_a(&[], &d("qukf\\Y", Tanadi), &["akfta"]); + assert_has_ta(&[], &d("qukf\\Y", Tanadi), Lun, &["akfta"]); } #[test] @@ -560,8 +578,8 @@ fn sutra_3_1_80() { #[test] fn sutra_3_1_81() { - assert_has_lat_p(&[], &d("qukfI\\Y", Kryadi), &["krIRAti"]); - assert_has_lat_p(&[], &d("prI\\Y", Kryadi), &["prIRAti"]); + assert_has_tip(&[], &d("qukfI\\Y", Kryadi), Lat, &["krIRAti"]); + assert_has_tip(&[], &d("prI\\Y", Kryadi), Lat, &["prIRAti"]); } #[test] @@ -570,7 +588,7 @@ fn sutra_3_1_82() { assert_has_lat(&[], &d("stunBu~", Kryadi), &["stuBnAti", "stuBnoti"]); assert_has_lat(&[], &d("skanBu~", Kryadi), &["skaBnAti", "skaBnoti"]); assert_has_lat(&[], &d("skunBu~", Kryadi), &["skuBnAti", "skuBnoti"]); - assert_has_lat_p(&[], &d("sku\\Y", Kryadi), &["skunAti", "skunoti"]); + assert_has_tip(&[], &d("sku\\Y", Kryadi), Lat, &["skunAti", "skunoti"]); } #[test] @@ -610,8 +628,8 @@ fn sutra_3_1_93() { let kf = d("qukf\\Y", Tanadi); assert_has_krdanta(&[], &kf, Krt::tavya, &["kartavya"]); assert_has_krdanta(&[], &kf, Krt::anIyar, &["karaRIya"]); - assert_has_ashirlin_p(&[], &d("ci\\Y", Svadi), &["cIyAt"]); - assert_has_ashirlin_p(&[], &d("zwu\\Y", Adadi), &["stUyAt"]); + assert_has_tip(&[], &d("ci\\Y", Svadi), AshirLin, &["cIyAt"]); + assert_has_tip(&[], &d("zwu\\Y", Adadi), AshirLin, &["stUyAt"]); } // krt-pratyayas diff --git a/vidyut-prakriya/tests/kashika_3_2.rs b/vidyut-prakriya/tests/kashika_3_2.rs index afa0706..53e2965 100644 --- a/vidyut-prakriya/tests/kashika_3_2.rs +++ b/vidyut-prakriya/tests/kashika_3_2.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::*; @@ -1009,26 +1010,26 @@ fn sutra_3_2_108() { #[test] fn sutra_3_2_110() { - assert_has_lun_p(&[], &d("qukf\\Y", Tanadi), &["akArzIt"]); - assert_has_lun_p(&[], &d("hf\\Y", Bhvadi), &["ahArzIt"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lun, &["akArzIt"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lun, &["ahArzIt"]); } #[test] fn sutra_3_2_111() { - assert_has_lan_p(&[], &d("qukf\\Y", Tanadi), &["akarot"]); - assert_has_lan_p(&[], &d("hf\\Y", Bhvadi), &["aharat"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lan, &["akarot"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lan, &["aharat"]); } #[test] fn sutra_3_2_115() { - assert_has_lit_p(&[], &d("qukf\\Y", Tanadi), &["cakAra"]); - assert_has_lit_p(&[], &d("hf\\Y", Bhvadi), &["jahAra"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lit, &["cakAra"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lit, &["jahAra"]); } #[test] fn sutra_3_2_123() { - assert_has_lat_p(&[], &d("qupa\\ca~^z", Bhvadi), &["pacati"]); - assert_has_lat_p(&[], &d("paWa~", Bhvadi), &["paWati"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lat, &["pacati"]); + assert_has_tip(&[], &d("paWa~", Bhvadi), Lat, &["paWati"]); } #[ignore] diff --git a/vidyut-prakriya/tests/kashika_3_3.rs b/vidyut-prakriya/tests/kashika_3_3.rs index 44fde43..5da72cb 100644 --- a/vidyut-prakriya/tests/kashika_3_3.rs +++ b/vidyut-prakriya/tests/kashika_3_3.rs @@ -1,42 +1,44 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::KrtArtha::*; +use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::*; -fn assert_has_bhave_krdanta(upapadas: &[&str], dhatu: &Dhatu, krt: Krt, expected: &[&str]) { +fn assert_has_bhave_krdanta(upapadas: &[&str], dhatu: &Dhatu, krt: BaseKrt, expected: &[&str]) { assert_has_artha_krdanta(upapadas, dhatu, KrtArtha::Bhava, krt, expected); } -fn assert_krt_blocked(upapadas: &[&str], dhatu: &Dhatu, krt: Krt) { +fn assert_krt_blocked(upapadas: &[&str], dhatu: &Dhatu, krt: BaseKrt) { assert_has_krdanta(upapadas, dhatu, krt, &[]); } #[test] fn sutra_3_3_1() { - assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Krt::uR, &["kAru"]); - assert_has_krdanta(&[], &d("pA\\", Bhvadi), Krt::uR, &["pAyu"]); - assert_has_krdanta(&[], &d("vA\\", Adadi), Krt::uR, &["vAyu"]); - assert_has_krdanta(&[], &d("ji\\", Bhvadi), Krt::uR, &["jAyu"]); - assert_has_krdanta(&[], &d("qumi\\Y", Svadi), Krt::uR, &["mAyu"]); - assert_has_krdanta(&[], &d("zvada~\\", Bhvadi), Krt::uR, &["svAdu"]); - assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Krt::uR, &["sADu"]); - assert_has_krdanta(&[], &d("aSU~\\", Svadi), Krt::uR, &["ASu"]); + assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Unadi::uR, &["kAru"]); + assert_has_krdanta(&[], &d("pA\\", Bhvadi), Unadi::uR, &["pAyu"]); + assert_has_krdanta(&[], &d("vA\\", Adadi), Unadi::uR, &["vAyu"]); + assert_has_krdanta(&[], &d("ji\\", Bhvadi), Unadi::uR, &["jAyu"]); + assert_has_krdanta(&[], &d("qumi\\Y", Svadi), Unadi::uR, &["mAyu"]); + assert_has_krdanta(&[], &d("zvada~\\", Bhvadi), Unadi::uR, &["svAdu"]); + assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Unadi::uR, &["sADu"]); + assert_has_krdanta(&[], &d("aSU~\\", Svadi), Unadi::uR, &["ASu"]); // For more specific uNAdi tests, see `kaumudi_67.rs` } #[test] fn sutra_3_3_2() { - assert_has_krdanta(&[], &d("vftu~\\", Bhvadi), Krt::manin, &["vartman"]); - assert_has_krdanta(&[], &d("cara~", Bhvadi), Krt::manin, &["carman"]); + assert_has_krdanta(&[], &d("vftu~\\", Bhvadi), Unadi::manin, &["vartman"]); + assert_has_krdanta(&[], &d("cara~", Bhvadi), Unadi::manin, &["carman"]); } #[test] fn sutra_3_3_3() { - use Krt::ini; use Krt::GinuR; use Krt::Rini; + use Unadi::ini; let gam = d("ga\\mx~", Bhvadi); assert_has_krdanta(&[], &gam, ini, &["gamin"]); assert_has_krdanta(&["AN"], &gam, ini, &["AgAmin"]); @@ -57,14 +59,14 @@ fn sutra_3_3_10() { #[test] fn sutra_3_3_13() { - assert_has_lrt_p(&[], &d("qukf\\Y", Tanadi), &["karizyati"]); - assert_has_lrt_p(&[], &d("hf\\Y", Bhvadi), &["harizyati"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lrt, &["karizyati"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lrt, &["harizyati"]); } #[test] fn sutra_3_3_15() { - assert_has_lut_p(&[], &d("qukf\\Y", Tanadi), &["kartA"]); - assert_has_lut_p(&[], &d("Bu\\ja~", Rudhadi), &["BoktA"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lut, &["kartA"]); + assert_has_tip(&[], &d("Bu\\ja~", Rudhadi), Lut, &["BoktA"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_3_4.rs b/vidyut-prakriya/tests/kashika_3_4.rs index efd706d..0b6ffdf 100644 --- a/vidyut-prakriya/tests/kashika_3_4.rs +++ b/vidyut-prakriya/tests/kashika_3_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -293,8 +294,8 @@ fn sutra_3_4_104() { assert_has_tas(&[], &jagf, AshirLin, &["jAgaryAstAm"]); assert_has_jhi(&[], &jagf, AshirLin, &["jAgaryAsuH"]); // Counterexamples - assert_has_vidhilin_p(&[], &d("va\\ca~", Adadi), &["vacyAt"]); - assert_has_vidhilin_p(&[], &jagf, &["jAgfyAt"]); + assert_has_tip(&[], &d("va\\ca~", Adadi), VidhiLin, &["vacyAt"]); + assert_has_tip(&[], &jagf, VidhiLin, &["jAgfyAt"]); } #[test] @@ -374,10 +375,10 @@ fn sutra_3_4_112() { #[test] fn sutra_3_4_113() { - assert_has_lat_p(&[], &d("BU", Bhvadi), &["Bavati"]); - assert_has_lat_p(&[], &d("RI\\Y", Bhvadi), &["nayati"]); - assert_has_lat_p(&[], &d("Yizva\\pa~", Adadi), &["svapiti"]); - assert_has_lat_p(&[], &d("rudi~r", Adadi), &["roditi"]); + assert_has_tip(&[], &d("BU", Bhvadi), Lat, &["Bavati"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lat, &["nayati"]); + assert_has_tip(&[], &d("Yizva\\pa~", Adadi), Lat, &["svapiti"]); + assert_has_tip(&[], &d("rudi~r", Adadi), Lat, &["roditi"]); assert_has_krdanta(&[], &d("qupa\\ca~^z", Bhvadi), Krt::SAnac, &["pacamAna"]); assert_has_krdanta(&[], &d("ya\\ja~^", Bhvadi), Krt::SAnac, &["yajamAna"]); } @@ -401,8 +402,8 @@ fn sutra_3_4_114() { fn sutra_3_4_115() { assert_has_sip(&[], &d("qupa\\ca~^z", Adadi), Lit, &["peciTa", "papakTa"]); assert_has_sip(&[], &d("Sa\\kx~", Adadi), Lit, &["SekiTa", "SaSakTa"]); - assert_has_lit_karmani(&[], &d("glE\\", Bhvadi), &["jagle"]); - assert_has_lit_karmani(&[], &d("mlE\\", Bhvadi), &["mamle"]); + assert_has_ta_k(&[], &d("glE\\", Bhvadi), Lit, &["jagle"]); + assert_has_ta_k(&[], &d("mlE\\", Bhvadi), Lit, &["mamle"]); } #[test] @@ -410,11 +411,11 @@ fn sutra_3_4_116() { let lu = d("lUY", Gana::Kryadi); let pu = d("pUY", Gana::Kryadi); - assert_has_ashirlin_a(&[], &lu, &["lavizIzwa"]); - assert_has_ashirlin_a(&[], &pu, &["pavizIzwa"]); + assert_has_ta(&[], &lu, AshirLin, &["lavizIzwa"]); + assert_has_ta(&[], &pu, AshirLin, &["pavizIzwa"]); - assert_has_vidhilin_p(&[], &lu, &["lunIyAt"]); - assert_has_vidhilin_p(&[], &pu, &["punIyAt"]); + assert_has_tip(&[], &lu, VidhiLin, &["lunIyAt"]); + assert_has_tip(&[], &pu, VidhiLin, &["punIyAt"]); } // 3.4.117 is chAndasa. diff --git a/vidyut-prakriya/tests/kashika_4_4.rs b/vidyut-prakriya/tests/kashika_4_4.rs index f993079..340397f 100644 --- a/vidyut-prakriya/tests/kashika_4_4.rs +++ b/vidyut-prakriya/tests/kashika_4_4.rs @@ -5,6 +5,7 @@ /// system does not model semantics, we have no easy way to implement apavada tests in practice. extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Taddhita as T; use vidyut_prakriya::args::TaddhitaArtha::*; @@ -550,3 +551,15 @@ fn sutra_4_4_83() { assert_has_artha_taddhita("Uru", TadVidhyati, T::yat, &["Uravya"]); // TODO: a-DanuzA } + +#[test] +fn sutra_4_4_91() { + assert_has_taddhitanta(&prati("nO"), T::yat, &["nAvya"]); + assert_has_taddhitanta(&prati("vayas"), T::yat, &["vayasya"]); + assert_has_taddhitanta(&prati("Darma"), T::yat, &["Darmya"]); + assert_has_taddhitanta(&prati("viza"), T::yat, &["vizya"]); + assert_has_taddhitanta(&prati("mUla"), T::yat, &["mUlya"]); + assert_has_taddhitanta(&prati("sItA"), T::yat, &["sItya"]); + assert_has_taddhitanta(&prati("tulA"), T::yat, &["tulya"]); + // TODO: others +} diff --git a/vidyut-prakriya/tests/kashika_6_1.rs b/vidyut-prakriya/tests/kashika_6_1.rs index fc92e9e..ef1672e 100644 --- a/vidyut-prakriya/tests/kashika_6_1.rs +++ b/vidyut-prakriya/tests/kashika_6_1.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -10,30 +11,31 @@ use vidyut_prakriya::args::*; #[test] fn sutra_6_1_1() { - assert_has_lit_p( + assert_has_tip( &[], &d("jAgf", Adadi), + Lit, &["jajAgAra", "jAgarAYcakAra", "jAgarAmbaBUva", "jAgarAmAsa"], ); - assert_has_lit_p(&[], &d("qupa\\ca~^z", Bhvadi), &["papAca"]); - assert_has_lit_p(&[], &d("i\\R", Adadi), &["iyAya"]); - assert_has_lit_p(&[], &d("f\\", Juhotyadi), &["Ara"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lit, &["papAca"]); + assert_has_tip(&[], &d("i\\R", Adadi), Lit, &["iyAya"]); + assert_has_tip(&[], &d("f\\", Juhotyadi), Lit, &["Ara"]); } #[test] fn sutra_6_1_2() { let san = |u, g| d(u, g).with_sanadi(&[Sanadi::San]); - assert_has_lat_p(&[], &san("awa~", Bhvadi), &["awiwizati"]); - assert_has_lat_p(&[], &san("aSa~", Kryadi), &["aSiSizati"]); - assert_has_lat_p(&[], &san("f\\", Kryadi), &["aririzati"]); + assert_has_tip(&[], &san("awa~", Bhvadi), Lat, &["awiwizati"]); + assert_has_tip(&[], &san("aSa~", Kryadi), Lat, &["aSiSizati"]); + assert_has_tip(&[], &san("f\\", Kryadi), Lat, &["aririzati"]); } #[test] fn sutra_6_1_3() { let san = |u, g| d(u, g).with_sanadi(&[Sanadi::San]); - assert_has_lat_p(&[], &san("undI~", Rudhadi), &["undidizati"]); - assert_has_lat_p(&[], &san("adqa~", Bhvadi), &["aqqiqizati"]); - assert_has_lat_p(&[], &san("arca~", Bhvadi), &["arcicizati"]); + assert_has_tip(&[], &san("undI~", Rudhadi), Lat, &["undidizati"]); + assert_has_tip(&[], &san("adqa~", Bhvadi), Lat, &["aqqiqizati"]); + assert_has_tip(&[], &san("arca~", Bhvadi), Lat, &["arcicizati"]); // ndrA assert_has_lat(&[], &san("Ikza~\\", Bhvadi), &["Icikzizate"]); // saMyoga @@ -61,11 +63,11 @@ fn sutra_6_1_4() { let san = |d: &Dhatu| d.clone().with_sanadi(&[Sanadi::San]); let yan = |d: &Dhatu| d.clone().with_sanadi(&[Sanadi::Yan]); - assert_has_lit_p(&[], &pac, &["papAca"]); - assert_has_lat_p(&[], &san(&pac), &["pipakzati"]); + assert_has_tip(&[], &pac, Lit, &["papAca"]); + assert_has_tip(&[], &san(&pac), Lat, &["pipakzati"]); assert_has_lat(&[], &yan(&pac), &["pApacyate"]); - assert_has_lat_p(&[], &d("hu\\", Juhotyadi), &["juhoti"]); - assert_has_lun_p(&[], &nic(&pac), &["apIpacat"]); + assert_has_tip(&[], &d("hu\\", Juhotyadi), Lat, &["juhoti"]); + assert_has_tip(&[], &nic(&pac), Lun, &["apIpacat"]); } #[test] @@ -96,24 +98,24 @@ fn sutra_6_1_7() { #[test] fn sutra_6_1_8() { - assert_has_lit_p(&[], &d("qupa\\ca~^z", Bhvadi), &["papAca"]); - assert_has_lit_p(&[], &d("paWa~", Bhvadi), &["papAWa"]); - assert_has_lit_p(&["pra"], &d("UrRuY", Adadi), &["prorRunAva"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lit, &["papAca"]); + assert_has_tip(&[], &d("paWa~", Bhvadi), Lit, &["papAWa"]); + assert_has_tip(&["pra"], &d("UrRuY", Adadi), Lit, &["prorRunAva"]); // liwi assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Krt::tfc, &["kartf"]); assert_has_krdanta(&[], &d("hf\\Y", Bhvadi), Krt::tfc, &["hartf"]); // TODO: nonAva (amantra) - // assert_has_lit_p(&[], &yan_luk(&d("nu", Adadi)), &["nonAva"]); + // assert_has_tip(&[], &yan_luk(&d("nu", Adadi)), Lit, &["nonAva"]); } #[test] fn sutra_6_1_9() { let pac = d("qupa\\ca~^z", Bhvadi); let f = d("f\\", Juhotyadi); - assert_has_lat_p(&[], &san(&pac), &["pipakzati"]); + assert_has_tip(&[], &san(&pac), Lat, &["pipakzati"]); assert_has_lat(&[], &san(&d("patx~", Bhvadi)), &["pipatizati", "pitsati"]); - assert_has_lat_p(&[], &san(&f), &["aririzati"]); - assert_has_lat_p(&[], &san(&d("undI~", Rudhadi)), &["undidizati"]); + assert_has_tip(&[], &san(&f), Lat, &["aririzati"]); + assert_has_tip(&[], &san(&d("undI~", Rudhadi)), Lat, &["undidizati"]); // yan assert_has_lat(&[], &yan(&pac), &["pApacyate"]); assert_has_lat(&[], &yan(&d("awa~", Bhvadi)), &["awAwyate"]); @@ -128,20 +130,20 @@ fn sutra_6_1_9() { #[test] fn sutra_6_1_10() { - assert_has_lat_p(&[], &d("hu\\", Juhotyadi), &["juhoti"]); - assert_has_lat_p(&[], &d("YiBI\\", Juhotyadi), &["biBeti"]); - assert_has_lat_p(&[], &d("hrI\\", Juhotyadi), &["jihreti"]); + assert_has_tip(&[], &d("hu\\", Juhotyadi), Lat, &["juhoti"]); + assert_has_tip(&[], &d("YiBI\\", Juhotyadi), Lat, &["biBeti"]); + assert_has_tip(&[], &d("hrI\\", Juhotyadi), Lat, &["jihreti"]); } #[test] fn sutra_6_1_11() { let nic = |u, g| d(u, g).with_sanadi(&[Sanadi::Nic]); - assert_has_lun_p(&[], &nic("qupa\\ca~^z", Bhvadi), &["apIpacat"]); - assert_has_lun_p(&[], &nic("paWa~", Bhvadi), &["apIpaWat"]); - assert_has_lun_p(&[], &nic("awa~", Bhvadi), &["Awiwat"]); - assert_has_lun_p(&[], &nic("aSU~\\", Svadi), &["ASiSat"]); - assert_has_lun_p(&[], &nic("aSa~\\", Kryadi), &["ASiSat"]); + assert_has_tip(&[], &nic("qupa\\ca~^z", Bhvadi), Lun, &["apIpacat"]); + assert_has_tip(&[], &nic("paWa~", Bhvadi), Lun, &["apIpaWat"]); + assert_has_tip(&[], &nic("awa~", Bhvadi), Lun, &["Awiwat"]); + assert_has_tip(&[], &nic("aSU~\\", Svadi), Lun, &["ASiSat"]); + assert_has_tip(&[], &nic("aSa~\\", Kryadi), Lun, &["ASiSat"]); } #[test] @@ -195,14 +197,14 @@ fn sutra_6_1_16() { let grah = d("graha~^", Kryadi); assert_has_krdanta(&[], &grah, Krt::kta, &["gfhIta"]); assert_has_krdanta(&[], &grah, Krt::ktavatu, &["gfhItavat"]); - assert_has_lat_p(&[], &grah, &["gfhRAti"]); - assert_has_lat_a(&[], &yan(&grah), &["jarIgfhyate"]); + assert_has_tip(&[], &grah, Lat, &["gfhRAti"]); + assert_has_ta(&[], &yan(&grah), Lat, &["jarIgfhyate"]); let jya = d("jyA\\", Kryadi); assert_has_krdanta(&[], &jya, Krt::kta, &["jIna"]); assert_has_krdanta(&[], &jya, Krt::ktavatu, &["jInavat"]); - assert_has_lat_p(&[], &jya, &["jinAti"]); - assert_has_lat_a(&[], &yan(&jya), &["jejIyate"]); + assert_has_tip(&[], &jya, Lat, &["jinAti"]); + assert_has_ta(&[], &yan(&jya), Lat, &["jejIyate"]); let ve = d("ve\\Y", Bhvadi); assert_has_tas(&[], &ve, Lit, &["UyatuH", "UvatuH", "vavatuH"]); @@ -211,8 +213,8 @@ fn sutra_6_1_16() { let vyadh = d("vya\\Da~", Divadi); assert_has_krdanta(&[], &vyadh, Krt::kta, &["vidDa"]); assert_has_krdanta(&[], &vyadh, Krt::ktavatu, &["vidDavat"]); - assert_has_lat_p(&[], &vyadh, &["viDyati"]); - assert_has_lat_a(&[], &yan(&vyadh), &["veviDyate"]); + assert_has_tip(&[], &vyadh, Lat, &["viDyati"]); + assert_has_ta(&[], &yan(&vyadh), Lat, &["veviDyate"]); let vash = d("vaSa~", Adadi); assert_has_krdanta(&[], &vash, Krt::kta, &["uSita"]); @@ -223,8 +225,8 @@ fn sutra_6_1_16() { let vyac = d("vyaca~", Tudadi); assert_has_krdanta(&[], &vyac, Krt::kta, &["vicita"]); assert_has_krdanta(&[], &vyac, Krt::ktavatu, &["vicitavat"]); - assert_has_lat_p(&[], &vyac, &["vicati"]); - assert_has_lat_a(&[], &yan(&vyac), &["vevicyate"]); + assert_has_tip(&[], &vyac, Lat, &["vicati"]); + assert_has_ta(&[], &yan(&vyac), Lat, &["vevicyate"]); assert_has_krdanta(&["ud"], &vyac, Krt::tfc, &["udvicitf"]); assert_has_krdanta(&["ud"], &vyac, Krt::tumun, &["udvicitum"]); assert_has_krdanta(&["ud"], &vyac, Krt::tavya, &["udvicitavya"]); @@ -232,21 +234,21 @@ fn sutra_6_1_16() { let vrasc = d("o~vrascU~", Tudadi); assert_has_krdanta(&[], &vrasc, Krt::kta, &["vfkRa"]); assert_has_krdanta(&[], &vrasc, Krt::ktavatu, &["vfkRavat"]); - assert_has_lat_p(&[], &vrasc, &["vfScati"]); - assert_has_lat_a(&[], &yan(&vrasc), &["varIvfScyate"]); + assert_has_tip(&[], &vrasc, Lat, &["vfScati"]); + assert_has_ta(&[], &yan(&vrasc), Lat, &["varIvfScyate"]); let prach = d("pra\\Ca~", Tudadi); assert_has_krdanta(&[], &prach, Krt::kta, &["pfzwa"]); assert_has_krdanta(&[], &prach, Krt::ktavatu, &["pfzwavat"]); - assert_has_lat_p(&[], &prach, &["pfcCati"]); - assert_has_lat_a(&[], &yan(&prach), &["parIpfcCyate"]); + assert_has_tip(&[], &prach, Lat, &["pfcCati"]); + assert_has_ta(&[], &yan(&prach), Lat, &["parIpfcCyate"]); assert_has_krdanta(&[], &prach, Krt::naN, &["praSna"]); let bhrasj = d("Bra\\sja~^", Tudadi); assert_has_krdanta(&[], &bhrasj, Krt::kta, &["Bfzwa"]); assert_has_krdanta(&[], &bhrasj, Krt::ktavatu, &["Bfzwavat"]); - assert_has_lat_p(&[], &bhrasj, &["Bfjjati"]); - assert_has_lat_a(&[], &yan(&bhrasj), &["barIBfjjyate"]); + assert_has_tip(&[], &bhrasj, Lat, &["Bfjjati"]); + assert_has_ta(&[], &yan(&bhrasj), Lat, &["barIBfjjyate"]); } #[test] @@ -307,7 +309,7 @@ fn sutra_6_1_18() { assert_has_tas(&[], &svap_nic, Lun, &["asUzupatAm"]); assert_has_jhi(&[], &svap_nic, Lun, &["asUzupan"]); // caNi - assert_has_lat_karmani(&[], &svap_nic, &["svApyate"]); + assert_has_ta_k(&[], &svap_nic, Lat, &["svApyate"]); assert_has_krdanta(&[], &svap_nic, Krt::kta, &["svApita"]); } @@ -402,8 +404,8 @@ fn sutra_6_1_30() { #[test] fn sutra_6_1_31() { let svi = d("wuo~Svi", Bhvadi); - assert_has_lat_p(&[], &nic_san(&svi), &["SuSAvayizati", "SiSvAyayizati"]); - assert_has_lat_p(&[], &nic(&svi), &["aSUsavat", "aSiSvayat"]); + assert_has_tip(&[], &nic_san(&svi), Lat, &["SuSAvayizati", "SiSvAyayizati"]); + assert_has_tip(&[], &nic(&svi), Lat, &["aSUsavat", "aSiSvayat"]); } #[test] @@ -460,16 +462,16 @@ fn sutra_6_1_45() { assert_has_krdanta(&[], &d("zwu\\Y", Adadi), Krt::tfc, &["stotf"]); // aSiti let mlai = d("mlE\\", Bhvadi); - assert_has_lat_p(&[], &glai, &["glAyati"]); - assert_has_lat_p(&[], &mlai, &["mlAyati"]); - assert_has_lit_karmani(&[], &glai, &["jagle"]); - assert_has_lit_karmani(&[], &mlai, &["mamle"]); + assert_has_tip(&[], &glai, Lat, &["glAyati"]); + assert_has_tip(&[], &mlai, Lat, &["mlAyati"]); + assert_has_ta_k(&[], &glai, Lit, &["jagle"]); + assert_has_ta_k(&[], &mlai, Lit, &["mamle"]); } #[test] fn sutra_6_1_46() { let vye = d("vye\\Y", Bhvadi); - assert_has_lit_p(&["sam"], &vye, &["saMvivyAya"]); + assert_has_tip(&["sam"], &vye, Lit, &["saMvivyAya"]); assert_has_sip(&["sam"], &vye, Lit, &["saMvivyayiTa"]); } @@ -491,14 +493,19 @@ fn sutra_6_1_47() { #[test] fn sutra_6_1_48() { - assert_has_lat_p(&[], &nic(&d("qukrI\\Y", Kryadi)), &["krApayati"]); - assert_has_lat_p(&["aDi"], &nic(&d("i\\N", Adadi)), &["aDyApayati"]); - assert_has_lat_p(&[], &nic(&d("ji\\", Bhvadi)), &["jApayati"]); + assert_has_tip(&[], &nic(&d("qukrI\\Y", Kryadi)), Lat, &["krApayati"]); + assert_has_tip(&["aDi"], &nic(&d("i\\N", Adadi)), Lat, &["aDyApayati"]); + assert_has_tip(&[], &nic(&d("ji\\", Bhvadi)), Lat, &["jApayati"]); } #[test] fn sutra_6_1_49() { - assert_has_lat_p(&[], &nic(&d("zi\\Du~", Divadi)), &["sADayati", "seDayati"]); + assert_has_tip( + &[], + &nic(&d("zi\\Du~", Divadi)), + Lat, + &["sADayati", "seDayati"], + ); } #[test] @@ -534,15 +541,26 @@ fn sutra_6_1_51() { #[test] fn sutra_6_1_54() { - assert_has_lat_p(&[], &nic(&d("ci\\Y", Svadi)), &["cApayati", "cAyayati"]); - assert_has_lat_p(&[], &nic(&d("sPura~", Tudadi)), &["sPArayati", "sPorayati"]); + assert_has_tip( + &[], + &nic(&d("ci\\Y", Svadi)), + Lat, + &["cApayati", "cAyayati"], + ); + assert_has_tip( + &[], + &nic(&d("sPura~", Tudadi)), + Lat, + &["sPArayati", "sPorayati"], + ); } #[test] fn sutra_6_1_55() { - assert_has_lat_p( + assert_has_tip( &["pra"], &nic(&d("vI\\", Adadi)), + Lat, &["pravApayati", "pravAyayati"], ); } @@ -577,8 +595,8 @@ fn sutra_6_1_58() { assert_has_krdanta(&[], &dfs, Krt::tumun, &["drazwum"]); assert_has_krdanta(&[], &dfs, Krt::tavya, &["drazwavya"]); - assert_has_lun_p(&[], &sfj, &["asrAkzIt"]); - assert_has_lun_p(&[], &dfs, &["adrAkzIt", "adarSat"]); + assert_has_tip(&[], &sfj, Lun, &["asrAkzIt"]); + assert_has_tip(&[], &dfs, Lun, &["adrAkzIt", "adarSat"]); // jhali assert_has_krdanta(&[], &sfj, Krt::lyuw, &["sarjana"]); assert_has_krdanta(&[], &dfs, Krt::lyuw, &["darSana"]); @@ -612,14 +630,14 @@ fn sutra_6_1_59() { #[test] fn sutra_6_1_64() { assert_has_lat(&[], &d("zaha~\\", Bhvadi), &["sahate"]); - assert_has_lat_p(&[], &d("zi\\ca~^", Tudadi), &["siYcati"]); + assert_has_tip(&[], &d("zi\\ca~^", Tudadi), Lat, &["siYcati"]); // DAtu? // assert_has_sup_1p("zoqaSan", Pum, &["zoqaSa"]); assert_has_sup_1s("zaRqa", Pum, &["zaRqaH"]); assert_has_sup_1s("zaqika", Pum, &["zaqikaH"]); // AdeH? assert_has_lat(&[], &d("kaza~", Bhvadi), &["kazati"]); - assert_has_lat_p(&[], &d("laza~^", Bhvadi), &["lazati", "lazyati"]); + assert_has_tip(&[], &d("laza~^", Bhvadi), Lat, &["lazati", "lazyati"]); assert_has_lat(&[], &d("kf\\za~", Tudadi), &["kfzati"]); assert_has_lat(&[], &d("zWivu~", Bhvadi), &["zWIvati"]); assert_has_lat(&[], &d("zvazka~\\", Bhvadi), &["zvazkate"]); @@ -633,11 +651,11 @@ fn sutra_6_1_64() { #[test] fn sutra_6_1_65() { - assert_has_lat_p(&[], &d("RI\\Y", Bhvadi), &["nayati"]); - assert_has_lat_p(&[], &d("Ra\\ma~", Bhvadi), &["namati"]); - assert_has_lat_p(&[], &d("Ra\\ha~^", Divadi), &["nahyati"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lat, &["nayati"]); + assert_has_tip(&[], &d("Ra\\ma~", Bhvadi), Lat, &["namati"]); + assert_has_tip(&[], &d("Ra\\ha~^", Divadi), Lat, &["nahyati"]); // dhAtu-AdeH - assert_has_lat_p(&[], &d("aRa~", Bhvadi), &["aRati"]); + assert_has_tip(&[], &d("aRa~", Bhvadi), Lat, &["aRati"]); // TODO: others } @@ -652,8 +670,8 @@ fn sutra_6_1_66() { assert_has_jha(&[], &d("ya\\ja~^", Bhvadi), VidhiLin, &["yajeran"]); // vali? - assert_has_lat_karmani(&[], &d("UyI~\\", Bhvadi), &["Uyyate"]); - assert_has_lat_karmani(&[], &d("knUyI~\\", Bhvadi), &["knUyyate"]); + assert_has_ta_k(&[], &d("UyI~\\", Bhvadi), Lat, &["Uyyate"]); + assert_has_ta_k(&[], &d("knUyI~\\", Bhvadi), Lat, &["knUyyate"]); // TODO: others } @@ -736,8 +754,8 @@ fn sutra_6_1_80() { // tan-nimittasya? let u = d("u\\N", Bhvadi); - assert_has_lat_karmani(&["upa"], &u, &["upoyate"]); - assert_has_lan_karmani(&[], &u, &["Oyata"]); + assert_has_ta_k(&["upa"], &u, Lat, &["upoyate"]); + assert_has_ta_k(&[], &u, Lan, &["Oyata"]); assert_has_taddhitanta(&prati("loyamAna"), T::iY, &["lOyamAni"]); assert_has_taddhitanta(&prati("poyamAna"), T::iY, &["pOyamAni"]); } @@ -782,8 +800,8 @@ fn sutra_6_1_89() { assert_has_sip(&["upa"], &i, Lat, &["upEzi"]); assert_has_mip(&["upa"], &i, Lat, &["upEmi"]); let edh = d("eDa~\\", Bhvadi); - assert_has_lat_a(&["upa"], &edh, &["upEDate"]); - assert_has_lat_a(&["pra"], &edh, &["prEDate"]); + assert_has_ta(&["upa"], &edh, Lat, &["upEDate"]); + assert_has_ta(&["pra"], &edh, Lat, &["prEDate"]); // TODO: others } @@ -824,8 +842,8 @@ fn sutra_6_1_93() { #[test] fn sutra_6_1_94() { let il = d("ila~", Curadi); - assert_has_lat_p(&["upa"], &il, &["upelayati"]); - assert_has_lat_p(&["pra"], &il, &["prelayati"]); + assert_has_tip(&["upa"], &il, Lat, &["upelayati"]); + assert_has_tip(&["pra"], &il, Lat, &["prelayati"]); let uz = d("uza~", Bhvadi); assert_has_lat(&["upa"], &uz, &["upozati"]); @@ -1017,12 +1035,12 @@ fn sutra_6_1_114() { fn sutra_6_1_135() { let kf = d("qukf\\Y", Tanadi); - assert_has_lut_p(&["sam"], &kf, &["saMskartA", "saNkartA"]); + assert_has_tip(&["sam"], &kf, Lut, &["saMskartA", "saNkartA"]); assert_has_krdanta(&["sam"], &kf, Krt::tumun, &["saMskartum", "saNkartum"]); assert_has_krdanta(&["sam"], &kf, Krt::tavya, &["saMskartavya", "saNkartavya"]); - assert_has_ashirlin_a(&["sam"], &kf, &["saMskfzIzwa", "saNkfzIzwa"]); - assert_has_lat_karmani(&["sam"], &kf, &["saMskriyate", "saNkriyate"]); + assert_has_ta(&["sam"], &kf, AshirLin, &["saMskfzIzwa", "saNkfzIzwa"]); + assert_has_ta_k(&["sam"], &kf, Lat, &["saMskriyate", "saNkriyate"]); assert_has_tas(&["sam"], &kf, Lit, &["saYcaskaratuH", "saYcakratuH"]); assert_has_jhi(&["sam"], &kf, Lit, &["saYcaskaruH", "saYcakruH"]); @@ -1031,21 +1049,21 @@ fn sutra_6_1_135() { #[test] fn sutra_6_1_136() { let kr = d("qukf\\Y", Tanadi); - assert_has_lan_p(&["sam"], &kr, &["samaskarot", "samakarot"]); - assert_has_lun_p(&["sam"], &kr, &["samaskArzIt", "samakArzIt"]); - assert_has_lit_p(&["sam"], &kr, &["saYcaskAra", "saYcakAra"]); - assert_has_lit_p(&["pari"], &kr, &["paricaskAra", "paricakAra"]); + assert_has_tip(&["sam"], &kr, Lan, &["samaskarot", "samakarot"]); + assert_has_tip(&["sam"], &kr, Lun, &["samaskArzIt", "samakArzIt"]); + assert_has_tip(&["sam"], &kr, Lit, &["saYcaskAra", "saYcakAra"]); + assert_has_tip(&["pari"], &kr, Lit, &["paricaskAra", "paricakAra"]); } #[test] fn sutra_6_1_137() { let kf = d("qukf\\Y", Tanadi); - assert_has_lut_p(&["sam"], &kf, &["saMskartA", "saNkartA"]); + assert_has_tip(&["sam"], &kf, Lut, &["saMskartA", "saNkartA"]); assert_has_krdanta(&["sam"], &kf, Krt::tumun, &["saMskartum", "saNkartum"]); assert_has_krdanta(&["sam"], &kf, Krt::tavya, &["saMskartavya", "saNkartavya"]); - assert_has_lut_p(&["pari"], &kf, &["parizkartA", "parikartA"]); + assert_has_tip(&["pari"], &kf, Lut, &["parizkartA", "parikartA"]); assert_has_krdanta(&["pari"], &kf, Krt::tumun, &["parizkartum", "parikartum"]); assert_has_krdanta( &["pari"], @@ -1054,7 +1072,7 @@ fn sutra_6_1_137() { &["parizkartavya", "parikartavya"], ); - assert_has_lut_p(&["upa"], &kf, &["upaskartA", "upakartA"]); + assert_has_tip(&["upa"], &kf, Lut, &["upaskartA", "upakartA"]); assert_has_krdanta(&["upa"], &kf, Krt::tumun, &["upaskartum", "upakartum"]); assert_has_krdanta(&["upa"], &kf, Krt::tavya, &["upaskartavya", "upakartavya"]); } @@ -1063,7 +1081,7 @@ fn sutra_6_1_137() { fn sutra_6_1_139() { let kr = d("qukf\\Y", Tanadi); assert_has_krdanta(&["upa"], &kr, Krt::kta, &["upaskfta", "upakfta"]); - assert_has_lat_a(&["upa"], &kr, &["upaskurute", "upakurute"]); + assert_has_ta(&["upa"], &kr, Lat, &["upaskurute", "upakurute"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_6_3.rs b/vidyut-prakriya/tests/kashika_6_3.rs index cbd7059..716cdb9 100644 --- a/vidyut-prakriya/tests/kashika_6_3.rs +++ b/vidyut-prakriya/tests/kashika_6_3.rs @@ -1,10 +1,10 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Taddhita as T; use vidyut_prakriya::args::TaddhitaArtha::*; -use vidyut_prakriya::args::*; #[test] fn sutra_6_3_43() { diff --git a/vidyut-prakriya/tests/kashika_6_4.rs b/vidyut-prakriya/tests/kashika_6_4.rs index abb64a4..67f09b5 100644 --- a/vidyut-prakriya/tests/kashika_6_4.rs +++ b/vidyut-prakriya/tests/kashika_6_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -152,18 +153,19 @@ fn sutra_6_4_15() { #[test] fn sutra_6_4_16() { assert_has_lat(&[], &san(&d("vI\\", Adadi)), &["vivIzati"]); - assert_has_lat_p(&[], &san(&d("zwu\\Y", Adadi)), &["tuzwUzati"]); - assert_has_lat_p(&[], &san(&d("qukf\\Y", Tanadi)), &["cikIrzati"]); - assert_has_lat_p(&[], &san(&d("hf\\Y", Bhvadi)), &["jihIrzati"]); + assert_has_tip(&[], &san(&d("zwu\\Y", Adadi)), Lat, &["tuzwUzati"]); + assert_has_tip(&[], &san(&d("qukf\\Y", Tanadi)), Lat, &["cikIrzati"]); + assert_has_tip(&[], &san(&d("hf\\Y", Bhvadi)), Lat, &["jihIrzati"]); assert_has_lat(&[], &san(&d("ha\\na~", Adadi)), &["jiGAMsati"]); assert_has_lat(&["aDi"], &san(&d("i\\N", Adadi)), &["aDijigAMsate"]); } #[test] fn sutra_6_4_17() { - assert_has_lat_p( + assert_has_tip( &[], &san(&d("tanu~^", Tanadi)), + Lat, &["titanizati", "titaMsati", "titAMsati"], ); } @@ -268,21 +270,21 @@ fn sutra_6_4_24() { assert_has_krdanta(&[], &sras, Krt::kta, &["srasta"]); assert_has_krdanta(&[], &dhvas, Krt::kta, &["Dvasta"]); - assert_has_lat_karmani(&[], &sras, &["srasyate"]); - assert_has_lat_karmani(&[], &dhvas, &["Dvasyate"]); + assert_has_ta_k(&[], &sras, Lat, &["srasyate"]); + assert_has_ta_k(&[], &dhvas, Lat, &["Dvasyate"]); assert_has_lat(&[], &yan(&sras), &["sanIsrasyate"]); assert_has_lat(&[], &yan(&dhvas), &["danIDvasyate"]); let nand = d("wunadi~", Bhvadi); - assert_has_lat_karmani(&[], &nand, &["nandyate"]); + assert_has_ta_k(&[], &nand, Lat, &["nandyate"]); assert_has_lat(&[], &yan(&nand), &["nAnandyate"]); let ni = d("RI\\Y", Bhvadi); - assert_has_lat_karmani(&[], &ni, &["nIyate"]); + assert_has_ta_k(&[], &ni, Lat, &["nIyate"]); assert_has_lat(&[], &yan(&ni), &["nenIyate"]); let nah = d("Ra\\ha~^", Divadi); - assert_has_lat_karmani(&[], &nah, &["nahyate"]); + assert_has_ta_k(&[], &nah, Lat, &["nahyate"]); assert_has_lat(&[], &yan(&nah), &["nAnahyate"]); assert_has_krdanta(&[], &sras, Krt::tfc, &["sraMsitf"]); @@ -300,13 +302,13 @@ fn sutra_6_4_25() { #[test] fn sutra_6_4_26() { - assert_has_lat_p(&[], &d("ra\\nja~^", Bhvadi), &["rajati"]); + assert_has_tip(&[], &d("ra\\nja~^", Bhvadi), Lat, &["rajati"]); } #[test] fn sutra_6_4_26_v2() { let ranj_nic = nic(&d("ra\\nja~^", Divadi)); - assert_has_lat_p(&[], &ranj_nic, &["rajayati", "raYjayati"]); + assert_has_tip(&[], &ranj_nic, Lat, &["rajayati", "raYjayati"]); } #[test] @@ -368,7 +370,7 @@ fn sutra_6_4_32() { #[test] fn sutra_6_4_33() { - assert_has_lun_karmani(&[], &d("Ba\\njo~", Rudhadi), &["aBAji", "aBaYji"]); + assert_has_ta_k(&[], &d("Ba\\njo~", Rudhadi), Lun, &["aBAji", "aBaYji"]); } #[test] @@ -472,8 +474,8 @@ fn sutra_6_4_37() { assert_has_krdanta(&[], &pac, Krt::ktavatu, &["pakvavat"]); // Jali let gam = d("ga\\mx~", Bhvadi); - assert_has_lat_karmani(&[], &gam, &["gamyate"]); - assert_has_lat_karmani(&[], &d("ra\\mu~\\", Bhvadi), &["ramyate"]); + assert_has_ta_k(&[], &gam, Lat, &["gamyate"]); + assert_has_ta_k(&[], &d("ra\\mu~\\", Bhvadi), Lat, &["ramyate"]); // kNiti assert_has_krdanta(&[], &yam, Krt::tfc, &["yantf"]); assert_has_krdanta(&[], &yam, Krt::tavya, &["yantavya"]); @@ -524,29 +526,29 @@ fn sutra_6_4_42() { assert_has_krdanta(&[], &sanu, Krt::kta, &["sAta"]); assert_has_krdanta(&[], &sanu, Krt::ktavatu, &["sAtavat"]); assert_has_krdanta(&[], &sanu, Krt::ktin, &["sAti"]); - assert_has_lat_p(&[], &san(&sanu), &["sizAsati", "sisanizati"]); + assert_has_tip(&[], &san(&sanu), Lat, &["sizAsati", "sisanizati"]); let khan = d("Kanu~^", Bhvadi); assert_has_krdanta(&[], &khan, Krt::kta, &["KAta"]); assert_has_krdanta(&[], &khan, Krt::ktavatu, &["KAtavat"]); assert_has_krdanta(&[], &khan, Krt::ktin, &["KAti"]); - assert_has_lat_p(&[], &san(&khan), &["ciKanizati"]); + assert_has_tip(&[], &san(&khan), Lat, &["ciKanizati"]); // TODO: others } #[test] fn sutra_6_4_43() { let jan = d("janI~\\", Divadi); - assert_has_lat_karmani(&[], &jan, &["jAyate", "janyate"]); + assert_has_ta_k(&[], &jan, Lat, &["jAyate", "janyate"]); assert_has_lat(&[], &yan(&jan), &["jAjAyate", "jaYjanyate"]); let sanu = d("zaRu~^", Tanadi); - assert_has_lat_karmani(&[], &sanu, &["sAyate", "sanyate"]); + assert_has_ta_k(&[], &sanu, Lat, &["sAyate", "sanyate"]); assert_has_lat(&[], &yan(&sanu), &["sAsAyate", "saMsanyate"]); let khan = d("Kanu~^", Bhvadi); - assert_has_lat_karmani(&[], &khan, &["KAyate", "Kanyate"]); + assert_has_ta_k(&[], &khan, Lat, &["KAyate", "Kanyate"]); assert_has_lat(&[], &yan(&khan), &["cAKAyate", "caNKanyate"]); // Not for Syani @@ -556,7 +558,7 @@ fn sutra_6_4_43() { #[test] fn sutra_6_4_44() { let tan = d("tanu~^", Tanadi); - assert_has_lat_karmani(&[], &tan, &["tAyate", "tanyate"]); + assert_has_ta_k(&[], &tan, Lat, &["tAyate", "tanyate"]); assert_has_lat(&[], &yan(&tan), &["tantanyate"]); } @@ -594,8 +596,8 @@ fn sutra_6_4_48() { let hf = d("hf\\Y", Bhvadi); assert_has_krdanta(&[], &san(&kf), Krt::Rvul, &["cikIrzaka"]); assert_has_krdanta(&[], &san(&hf), Krt::Rvul, &["jihIrzaka"]); - assert_has_lat_karmani(&[], &san(&kf), &["cikIrzyate"]); - assert_has_lat_karmani(&[], &san(&hf), &["jihIrzyate"]); + assert_has_ta_k(&[], &san(&kf), Lat, &["cikIrzyate"]); + assert_has_ta_k(&[], &san(&hf), Lat, &["jihIrzyate"]); } #[test] @@ -617,10 +619,10 @@ fn sutra_6_4_49() { #[ignore] #[test] fn sutra_6_4_51() { - assert_has_lun_p(&[], &nic(&d("takza~", Bhvadi)), &["atatakzat"]); - assert_has_lun_p(&[], &nic(&d("rakza~", Bhvadi)), &["ararakzat"]); - assert_has_lun_p(&[], &nic(&d("aSa~", Kryadi)), &["ASiSat"]); - assert_has_lun_p(&[], &nic(&d("awa~", Bhvadi)), &["Awiwat"]); + assert_has_tip(&[], &nic(&d("takza~", Bhvadi)), Lun, &["atatakzat"]); + assert_has_tip(&[], &nic(&d("rakza~", Bhvadi)), Lun, &["ararakzat"]); + assert_has_tip(&[], &nic(&d("aSa~", Kryadi)), Lun, &["ASiSat"]); + assert_has_tip(&[], &nic(&d("awa~", Bhvadi)), Lun, &["Awiwat"]); let kf_nic = nic(&d("qukf\\Y", Tanadi)); let hf_nic = nic(&d("hf\\Y", Bhvadi)); @@ -628,8 +630,8 @@ fn sutra_6_4_51() { assert_has_krdanta(&[], &hf_nic, Krt::yuc, &["hAraRA"]); assert_has_krdanta(&[], &kf_nic, Krt::Rvul, &["kAraka"]); assert_has_krdanta(&[], &hf_nic, Krt::Rvul, &["hAraka"]); - assert_has_lat_karmani(&[], &kf_nic, &["kAryate"]); - assert_has_lat_karmani(&[], &hf_nic, &["hAryate"]); + assert_has_ta_k(&[], &kf_nic, Lat, &["kAryate"]); + assert_has_ta_k(&[], &hf_nic, Lat, &["hAryate"]); // TODO: jYIpsati @@ -653,29 +655,36 @@ fn sutra_6_4_55() { let hf_nic = nic(&d("hf\\Y", Bhvadi)); // Am - assert_has_lit_p( + assert_has_tip( &[], &kf_nic, + Lit, &["kArayAYcakAra", "kArayAmAsa", "kArayAmbaBUva"], ); - assert_has_lit_p( + assert_has_tip( &[], &hf_nic, + Lit, &["hArayAYcakAra", "hArayAmAsa", "hArayAmbaBUva"], ); let spfha = &d("spfha", Curadi); let gfha = &d("gfha", Curadi); // anta - assert_has_krdanta(&[], &nic(&d("gaqi~", Bhvadi)), Krt::Jac, &["gaRqayanta"]); - assert_has_krdanta(&[], &nic(&d("maqi~\\", Bhvadi)), Krt::Jac, &["maRqayanta"]); + assert_has_krdanta(&[], &nic(&d("gaqi~", Bhvadi)), Unadi::Jac, &["gaRqayanta"]); + assert_has_krdanta( + &[], + &nic(&d("maqi~\\", Bhvadi)), + Unadi::Jac, + &["maRqayanta"], + ); // Alu assert_has_krdanta(&[], &spfha, Krt::Aluc, &["spfhayAlu"]); assert_has_krdanta(&[], &gfha, Krt::Aluc, &["gfhayAlu"]); // Ayya - assert_has_krdanta(&[], &spfha, Krt::Ayya, &["spfhayAyya"]); - assert_has_krdanta(&[], &gfha, Krt::Ayya, &["gfhayAyya"]); + assert_has_krdanta(&[], &spfha, Unadi::Ayya, &["spfhayAyya"]); + assert_has_krdanta(&[], &gfha, Unadi::Ayya, &["gfhayAyya"]); // itnu - assert_has_krdanta(&[], &d("stana", Curadi), Krt::itnuc, &["stanayitnu"]); + assert_has_krdanta(&[], &d("stana", Curadi), Unadi::itnuc, &["stanayitnu"]); assert_has_krdanta(&[], &nic(&d("puza~", Kryadi)), Krt::izRuc, &["pozayizRu"]); assert_has_krdanta(&[], &d("pAra", Curadi), Krt::izRuc, &["pArayizRu"]); } @@ -796,7 +805,7 @@ fn sutra_6_4_64() { assert_has_jhi(&[], &d("vA\\", Adadi), Lat, &["vAnti"]); // aci - assert_has_lat_karmani(&[], &d("glE\\", Bhvadi), &["glAyate"]); + assert_has_ta_k(&[], &d("glE\\", Bhvadi), Lat, &["glAyate"]); assert_has_iw(&[], &d("qudA\\Y", Juhotyadi), AshirLin, &["dAsIya"]); // TODO: others @@ -814,22 +823,22 @@ fn sutra_6_4_65() { fn sutra_6_4_66() { let daa = d("qudA\\Y", Juhotyadi); let dhaa = d("quDA\\Y", Juhotyadi); - assert_has_lat_karmani(&[], &daa, &["dIyate"]); - assert_has_lat_karmani(&[], &dhaa, &["DIyate"]); + assert_has_ta_k(&[], &daa, Lat, &["dIyate"]); + assert_has_ta_k(&[], &dhaa, Lat, &["DIyate"]); assert_has_lat(&[], &yan(&daa), &["dedIyate"]); assert_has_lat(&[], &yan(&dhaa), &["deDIyate"]); let maa = d("mA\\", Adadi); - assert_has_lat_karmani(&[], &maa, &["mIyate"]); + assert_has_ta_k(&[], &maa, Lat, &["mIyate"]); assert_has_lat(&[], &yan(&maa), &["memIyate"]); let sthaa = d("zWA\\", Bhvadi); - assert_has_lat_karmani(&[], &sthaa, &["sTIyate"]); + assert_has_ta_k(&[], &sthaa, Lat, &["sTIyate"]); assert_has_lat(&[], &yan(&sthaa), &["tezWIyate"]); let gai = d("gE\\", Bhvadi); let i = d("i\\N", Adadi); - assert_has_lat_karmani(&[], &gai, &["gIyate"]); + assert_has_ta_k(&[], &gai, Lat, &["gIyate"]); assert_has_lat(&[], &yan(&gai), &["jegIyate"]); assert_has_ta(&["aDi"], &i, Lun, &["aDyEzwa", "aDyagIzwa"]); assert_has_aataam(&["aDi"], &i, Lun, &["aDyEzAtAm", "aDyagIzAtAm"]); @@ -837,18 +846,18 @@ fn sutra_6_4_66() { let paa = d("pA\\", Bhvadi); let paa_paati = d("pA\\", Adadi); - assert_has_lat_karmani(&[], &paa, &["pIyate"]); + assert_has_ta_k(&[], &paa, Lat, &["pIyate"]); assert_has_lat(&[], &yan(&paa), &["pepIyate"]); - assert_has_lat_karmani(&[], &paa_paati, &["pAyate"]); + assert_has_ta_k(&[], &paa_paati, Lat, &["pAyate"]); let haak = d("o~hA\\k", Juhotyadi); let haan = d("o~hA\\N", Juhotyadi); - assert_has_lat_karmani(&[], &haak, &["hIyate"]); + assert_has_ta_k(&[], &haak, Lat, &["hIyate"]); assert_has_lat(&[], &yan(&haak), &["jehIyate"]); - assert_has_lat_karmani(&[], &haan, &["hAyate"]); + assert_has_ta_k(&[], &haan, Lat, &["hAyate"]); let so = d("zo\\", Divadi); - assert_has_lat_karmani(&["ava"], &so, &["avasIyate"]); + assert_has_ta_k(&["ava"], &so, Lat, &["avasIyate"]); // TODO: not sure if a typo assert_has_lat(&["ava"], &yan(&so), &["avasezIyate"]); @@ -864,33 +873,33 @@ fn sutra_6_4_66() { fn sutra_6_4_67() { let daa = d("qudA\\Y", Juhotyadi); let dhaa = d("quDA\\Y", Juhotyadi); - assert_has_ashirlin_p(&[], &daa, &["deyAt"]); - assert_has_ashirlin_p(&[], &dhaa, &["DeyAt"]); - assert_has_ashirlin_p(&[], &d("mA\\", Adadi), &["meyAt"]); - assert_has_ashirlin_p(&[], &d("zWA\\", Bhvadi), &["sTeyAt"]); - assert_has_ashirlin_p(&[], &d("gE\\", Bhvadi), &["geyAt"]); - assert_has_ashirlin_p(&[], &d("pA\\", Bhvadi), &["peyAt"]); - assert_has_ashirlin_p(&[], &d("o~hA\\k", Juhotyadi), &["heyAt"]); - assert_has_ashirlin_p(&["ava"], &d("zo\\", Divadi), &["avaseyAt"]); + assert_has_tip(&[], &daa, AshirLin, &["deyAt"]); + assert_has_tip(&[], &dhaa, AshirLin, &["DeyAt"]); + assert_has_tip(&[], &d("mA\\", Adadi), AshirLin, &["meyAt"]); + assert_has_tip(&[], &d("zWA\\", Bhvadi), AshirLin, &["sTeyAt"]); + assert_has_tip(&[], &d("gE\\", Bhvadi), AshirLin, &["geyAt"]); + assert_has_tip(&[], &d("pA\\", Bhvadi), AshirLin, &["peyAt"]); + assert_has_tip(&[], &d("o~hA\\k", Juhotyadi), AshirLin, &["heyAt"]); + assert_has_tip(&["ava"], &d("zo\\", Divadi), AshirLin, &["avaseyAt"]); // kNiti - assert_has_ashirlin_a(&[], &daa, &["dAsIzwa"]); - assert_has_ashirlin_a(&[], &dhaa, &["DAsIzwa"]); + assert_has_ta(&[], &daa, AshirLin, &["dAsIzwa"]); + assert_has_ta(&[], &dhaa, AshirLin, &["DAsIzwa"]); } #[test] fn sutra_6_4_68() { let glai = d("glE\\", Bhvadi); - assert_has_ashirlin_p(&[], &glai, &["gleyAt", "glAyAt"]); - assert_has_ashirlin_p(&[], &d("mlE\\", Bhvadi), &["mleyAt", "mlAyAt"]); + assert_has_tip(&[], &glai, AshirLin, &["gleyAt", "glAyAt"]); + assert_has_tip(&[], &d("mlE\\", Bhvadi), AshirLin, &["mleyAt", "mlAyAt"]); // anyasya - assert_has_ashirlin_p(&[], &d("zWA\\", Bhvadi), &["sTeyAt"]); + assert_has_tip(&[], &d("zWA\\", Bhvadi), AshirLin, &["sTeyAt"]); // saMyogAdeH - assert_has_ashirlin_p(&[], &d("yA\\", Adadi), &["yAyAt"]); + assert_has_tip(&[], &d("yA\\", Adadi), AshirLin, &["yAyAt"]); // kNiti - assert_has_ashirlin_karmani(&[], &glai, &["glAsIzwa", "glAyizIzwa"]); + assert_has_ta_k(&[], &glai, AshirLin, &["glAsIzwa", "glAyizIzwa"]); // aNgasya - assert_has_ashirlin_p(&["nis"], &d("vA\\", Adadi), &["nirvAyAt"]); + assert_has_tip(&["nis"], &d("vA\\", Adadi), AshirLin, &["nirvAyAt"]); } #[test] @@ -920,12 +929,12 @@ fn sutra_6_4_71() { let kf = d("qukf\\Y", Tanadi); let hf = d("hf\\Y", Bhvadi); - assert_has_lun_p(&[], &kf, &["akArzIt"]); - assert_has_lun_p(&[], &hf, &["ahArzIt"]); - assert_has_lan_p(&[], &kf, &["akarot"]); - assert_has_lan_p(&[], &hf, &["aharat"]); - assert_has_lrn_p(&[], &kf, &["akarizyat"]); - assert_has_lrn_p(&[], &hf, &["aharizyat"]); + assert_has_tip(&[], &kf, Lun, &["akArzIt"]); + assert_has_tip(&[], &hf, Lun, &["ahArzIt"]); + assert_has_tip(&[], &kf, Lan, &["akarot"]); + assert_has_tip(&[], &hf, Lan, &["aharat"]); + assert_has_tip(&[], &kf, Lrn, &["akarizyat"]); + assert_has_tip(&[], &hf, Lrn, &["aharizyat"]); } #[test] @@ -978,8 +987,8 @@ fn sutra_6_4_78() { ); // aci - assert_has_lit_p(&[], &d("ya\\ja~^", Bhvadi), &["iyAja"]); - assert_has_lit_p(&[], &d("quva\\pa~^", Bhvadi), &["uvApa"]); + assert_has_tip(&[], &d("ya\\ja~^", Bhvadi), Lit, &["iyAja"]); + assert_has_tip(&[], &d("quva\\pa~^", Bhvadi), Lit, &["uvApa"]); } #[test] @@ -1040,7 +1049,7 @@ fn sutra_6_4_88() { #[test] fn sutra_6_4_89() { let guh = d("guhU~^", Bhvadi); - assert_has_lat_p(&["ni"], &guh, &["nigUhati"]); + assert_has_tip(&["ni"], &guh, Lat, &["nigUhati"]); assert_has_krdanta(&["ni"], &guh, Krt::Rvul, &["nigUhaka"]); assert_has_krdanta(&["ni"], &guh, Krt::Rini, &["nigUhin"]); assert_has_krdanta(&["ni"], &guh, Krt::Ramul, &["nigUham"]); @@ -1056,23 +1065,24 @@ fn sutra_6_4_89() { #[test] fn sutra_6_4_90_and_sutra_6_4_91() { let dus = nic(&d("du\\za~", Divadi)); - assert_has_lat_p(&[], &dus, &["dUzayati", "dozayati"]); + assert_has_tip(&[], &dus, Lat, &["dUzayati", "dozayati"]); } #[test] fn sutra_6_4_92() { - assert_has_lat_p(&[], &nic(&d("Gawa~\\", Bhvadi)), &["Gawayati"]); - assert_has_lat_p(&[], &nic(&d("vyaTa~\\", Bhvadi)), &["vyaTayati"]); - assert_has_lat_p(&[], &nic(&d("janI~\\", Divadi)), &["janayati"]); - assert_has_lat_p( + assert_has_tip(&[], &nic(&d("Gawa~\\", Bhvadi)), Lat, &["Gawayati"]); + assert_has_tip(&[], &nic(&d("vyaTa~\\", Bhvadi)), Lat, &["vyaTayati"]); + assert_has_tip(&[], &nic(&d("janI~\\", Divadi)), Lat, &["janayati"]); + assert_has_tip( &[], &nic(&d("ra\\nja~^", Divadi)), + Lat, &["rajayati", "raYjayati"], ); // TODO: not sure - // assert_has_lat_p(&[], &nic("Samu~", Bhvadi), &["Samayati"]); - // assert_has_lat_p(&[], &nic("", Bhvadi), &["jYapayati"]); + // assert_has_tip(&[], &nic("Samu~", Bhvadi), Lat, &["Samayati"]); + // assert_has_tip(&[], &nic("", Bhvadi), Lat, &["jYapayati"]); } #[ignore] @@ -1097,7 +1107,7 @@ fn sutra_6_4_96_v1() { #[test] fn sutra_6_4_97() { let chad = d("Cada~", Curadi); - assert_has_krdanta(&[], &chad, Krt::isi, &["Cadis"]); + assert_has_krdanta(&[], &chad, Unadi::isi, &["Cadis"]); assert_has_krdanta(&[], &chad, Krt::manin, &["Cadman"]); assert_has_krdanta(&[], &chad, Krt::zwran, &["Cattra"]); assert_has_upapada_krdanta("dAman", &[], &chad, Krt::kvip, &["dAmacCad"]); @@ -1136,8 +1146,8 @@ fn sutra_6_4_98() { assert_has_lun(&[], &ad, &["aGasat"]); // aci - assert_has_lat_karmani(&[], &gam, &["gamyate"]); - assert_has_lat_karmani(&[], &han, &["hanyate"]); + assert_has_ta_k(&[], &gam, Lat, &["gamyate"]); + assert_has_ta_k(&[], &han, Lat, &["hanyate"]); } #[test] @@ -1168,13 +1178,13 @@ fn sutra_6_4_101() { #[test] fn sutra_6_4_104() { - assert_has_lun_karmani(&[], &d("qukf\\Y", Tanadi), &["akAri"]); - assert_has_lun_karmani(&[], &d("hf\\Y", Bhvadi), &["ahAri"]); - assert_has_lun_karmani(&[], &d("lUY", Kryadi), &["alAvi"]); - assert_has_lun_karmani(&[], &d("qupa\\ca~^z", Bhvadi), &["apAci"]); + assert_has_ta_k(&[], &d("qukf\\Y", Tanadi), Lun, &["akAri"]); + assert_has_ta_k(&[], &d("hf\\Y", Bhvadi), Lun, &["ahAri"]); + assert_has_ta_k(&[], &d("lUY", Kryadi), Lun, &["alAvi"]); + assert_has_ta_k(&[], &d("qupa\\ca~^z", Bhvadi), Lun, &["apAci"]); // ciR - assert_has_lat_karmani(&[], &d("Bi\\di~^r", Rudhadi), &["Bidyate"]); + assert_has_ta_k(&[], &d("Bi\\di~^r", Rudhadi), Lat, &["Bidyate"]); // TODO: tarAm } @@ -1278,8 +1288,8 @@ fn sutra_6_4_111() { assert_has_tas(&[], &as_, Lat, &["staH"]); assert_has_jhi(&[], &as_, Lat, &["santi"]); // kNiti - assert_has_lat_p(&[], &bhid, &["Binatti"]); - assert_has_lat_p(&[], &as_, &["asti"]); + assert_has_tip(&[], &bhid, Lat, &["Binatti"]); + assert_has_tip(&[], &as_, Lat, &["asti"]); } #[test] @@ -1307,7 +1317,7 @@ fn sutra_6_4_112() { assert_has_jhi(&[], &d("quBf\\Y", Juhotyadi), Lat, &["biBrati"]); // kNiti - assert_has_lan_p(&[], &lu, &["alunAt"]); + assert_has_tip(&[], &lu, Lan, &["alunAt"]); } #[test] @@ -1318,8 +1328,8 @@ fn sutra_6_4_113() { assert_has_tas(&[], &pu, Lat, &["punItaH"]); assert_has_thas(&[], &lu, Lat, &["lunITaH"]); assert_has_thas(&[], &pu, Lat, &["punITaH"]); - assert_has_lat_a(&[], &lu, &["lunIte"]); - assert_has_lat_a(&[], &pu, &["punIte"]); + assert_has_ta(&[], &lu, Lat, &["lunIte"]); + assert_has_ta(&[], &pu, Lat, &["punIte"]); let maa = d("mA\\N", Juhotyadi); assert_has_ta(&[], &maa, Lat, &["mimIte"]); @@ -1340,8 +1350,8 @@ fn sutra_6_4_113() { assert_has_tas(&[], &d("quDA\\Y", Juhotyadi), Lat, &["DattaH"]); // kNiti - assert_has_lat_p(&[], &lu, &["lunAti"]); - assert_has_lat_p(&[], &d("o~hA\\k", Juhotyadi), &["jahAti"]); + assert_has_tip(&[], &lu, Lat, &["lunAti"]); + assert_has_tip(&[], &d("o~hA\\k", Juhotyadi), Lat, &["jahAti"]); } #[test] @@ -1374,7 +1384,7 @@ fn sutra_6_4_115() { assert_has_tip(&[], &bhi, Lat, &["biBeti"]); // sArvadhAtuke - assert_has_lat_karmani(&[], &bhi, &["BIyate"]); + assert_has_ta_k(&[], &bhi, Lat, &["BIyate"]); } #[test] @@ -1392,7 +1402,7 @@ fn sutra_6_4_116() { assert_has_tinanta(&[], &haa, Lat, Prathama, Eka, &["jahAti"]); // sArvadhAtuke - assert_has_lat_karmani(&[], &haa, &["hIyate"]); + assert_has_ta_k(&[], &haa, Lat, &["hIyate"]); assert_has_lat(&[], &yan(&haa), &["jehIyate"]); } diff --git a/vidyut-prakriya/tests/kashika_7_1.rs b/vidyut-prakriya/tests/kashika_7_1.rs index e190e33..b35830e 100644 --- a/vidyut-prakriya/tests/kashika_7_1.rs +++ b/vidyut-prakriya/tests/kashika_7_1.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -35,8 +36,8 @@ fn sutra_7_1_2() { // pratyayagrahanam assert_has_lat(&[], &d("Pakka~", Bhvadi), &["Pakkati"]); assert_has_lat(&[], &d("QOkf~\\", Bhvadi), &["QOkate"]); - assert_has_lat_p(&[], &d("Kanu~^", Bhvadi), &["Kanati"]); - assert_has_lat_p(&[], &d("Ci\\di~^r", Rudhadi), &["Cinatti"]); + assert_has_tip(&[], &d("Kanu~^", Bhvadi), Lat, &["Kanati"]); + assert_has_tip(&[], &d("Ci\\di~^r", Rudhadi), Lat, &["Cinatti"]); assert_has_lat(&[], &d("GurRa~\\", Bhvadi), &["GUrRate"]); // TODO: others @@ -346,17 +347,17 @@ fn sutra_7_1_33() { #[test] fn sutra_7_1_34() { - assert_has_lit_p(&[], &d("pE\\", Bhvadi), &["papO"]); - assert_has_lit_p(&[], &d("zWA\\", Bhvadi), &["tasTO"]); - assert_has_lit_p(&[], &d("glE\\", Bhvadi), &["jaglO"]); - assert_has_lit_p(&[], &d("mlE\\", Bhvadi), &["mamlO"]); + assert_has_tip(&[], &d("pE\\", Bhvadi), Lit, &["papO"]); + assert_has_tip(&[], &d("zWA\\", Bhvadi), Lit, &["tasTO"]); + assert_has_tip(&[], &d("glE\\", Bhvadi), Lit, &["jaglO"]); + assert_has_tip(&[], &d("mlE\\", Bhvadi), Lit, &["mamlO"]); } #[test] fn sutra_7_1_35() { assert_has_lot(&[], &d("jIva~", Bhvadi), &["jIvatAt", "jIvatu"]); assert_has_sip(&[], &d("jIva~", Bhvadi), Lot, &["jIvatAt", "jIva"]); - assert_has_lot_p(&[], &d("brUY", Adadi), &["brUtAt", "bravItu"]); + assert_has_tip(&[], &d("brUY", Adadi), Lot, &["brUtAt", "bravItu"]); } #[test] @@ -457,8 +458,8 @@ fn sutra_7_1_58() { assert_has_krdanta(&[], &hund, Krt::a, &["huRqA"]); // no idit - assert_has_lat_p(&[], &d("qupa\\ca~^z", Bhvadi), &["pacati"]); - assert_has_lat_p(&[], &d("paWa~", Bhvadi), &["paWati"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lat, &["pacati"]); + assert_has_tip(&[], &d("paWa~", Bhvadi), Lat, &["paWati"]); // irit is not idit assert_has_krdanta(&[], &d("Bi\\di~^r", Rudhadi), Krt::tfc, &["Bettf"]); @@ -468,21 +469,21 @@ fn sutra_7_1_58() { #[test] fn sutra_7_1_59() { let muc = d("mu\\cx~^", Tudadi); - assert_has_lat_p(&[], &muc, &["muYcati"]); - assert_has_lat_p(&[], &d("lu\\px~^", Tudadi), &["lumpati"]); - assert_has_lat_p(&[], &d("vi\\dx~^", Tudadi), &["vindati"]); - assert_has_lat_p(&[], &d("li\\pa~^", Tudadi), &["limpati"]); - assert_has_lat_p(&[], &d("zi\\ca~^", Tudadi), &["siYcati"]); - assert_has_lat_p(&[], &d("kftI~", Tudadi), &["kfntati"]); - assert_has_lat_p(&[], &d("Ki\\da~", Tudadi), &["Kindati"]); - assert_has_lat_p(&[], &d("piSa~", Tudadi), &["piMSati"]); + assert_has_tip(&[], &muc, Lat, &["muYcati"]); + assert_has_tip(&[], &d("lu\\px~^", Tudadi), Lat, &["lumpati"]); + assert_has_tip(&[], &d("vi\\dx~^", Tudadi), Lat, &["vindati"]); + assert_has_tip(&[], &d("li\\pa~^", Tudadi), Lat, &["limpati"]); + assert_has_tip(&[], &d("zi\\ca~^", Tudadi), Lat, &["siYcati"]); + assert_has_tip(&[], &d("kftI~", Tudadi), Lat, &["kfntati"]); + assert_has_tip(&[], &d("Ki\\da~", Tudadi), Lat, &["Kindati"]); + assert_has_tip(&[], &d("piSa~", Tudadi), Lat, &["piMSati"]); assert_has_krdanta(&[], &muc, Krt::tfc, &["moktf"]); assert_has_krdanta(&[], &muc, Krt::tumun, &["moktum"]); assert_has_krdanta(&[], &muc, Krt::tavya, &["moktavya"]); - assert_has_lat_p(&[], &d("tu\\da~^", Tudadi), &["tudati"]); - assert_has_lat_p(&[], &d("Ru\\da~^", Tudadi), &["nudati"]); + assert_has_tip(&[], &d("tu\\da~^", Tudadi), Lat, &["tudati"]); + assert_has_tip(&[], &d("Ru\\da~^", Tudadi), Lat, &["nudati"]); // TODO: varttika } @@ -510,9 +511,10 @@ fn sutra_7_1_60() { fn sutra_7_1_61() { let radh = d("ra\\Da~", Divadi); let jabh = d("jaBI~\\", Bhvadi); - assert_has_lat_p( + assert_has_tip( &[], &radh.clone().with_sanadi(&[Sanadi::Nic]), + Lat, &["ranDayati"], ); assert_has_krdanta(&[], &radh, Krt::Rvul, &["ranDaka"]); @@ -520,9 +522,10 @@ fn sutra_7_1_61() { assert_has_krdanta(&[], &radh, Krt::Ramul, &["ranDam"]); assert_has_krdanta(&[], &radh, Krt::GaY, &["ranDa"]); - assert_has_lat_p( + assert_has_tip( &[], &jabh.clone().with_sanadi(&[Sanadi::Nic]), + Lat, &["jamBayati"], ); assert_has_krdanta(&[], &jabh, Krt::Rvul, &["jamBaka"]); @@ -551,7 +554,7 @@ fn sutra_7_1_62() { #[test] fn sutra_7_1_63() { let rabh = d("ra\\Ba~\\", Bhvadi); - assert_has_lat_p(&["AN"], &nic(&rabh), &["AramBayati"]); + assert_has_tip(&["AN"], &nic(&rabh), Lat, &["AramBayati"]); assert_has_krdanta(&["AN"], &rabh, Krt::Rvul, &["AramBaka"]); assert_has_krdanta(&["AN"], &rabh, Krt::Rini, &["AramBin"]); assert_has_krdanta(&["AN"], &rabh, Krt::Ramul, &["AramBam"]); @@ -567,7 +570,7 @@ fn sutra_7_1_63() { #[test] fn sutra_7_1_64() { let labh = d("qula\\Ba~\\z", Bhvadi); - assert_has_lat_p(&[], &nic(&labh), &["lamBayati"]); + assert_has_tip(&[], &nic(&labh), Lat, &["lamBayati"]); assert_has_krdanta(&[], &labh, Krt::Rvul, &["lamBaka"]); assert_has_krdanta(&[], &labh, Krt::Rini, &["lamBin"]); assert_has_krdanta(&[], &labh, Krt::Ramul, &["lamBam", "lABam"]); @@ -640,11 +643,11 @@ fn sutra_7_1_68() { #[test] fn sutra_7_1_69() { let labh = d("qula\\Ba~\\z", Bhvadi); - assert_has_lun_karmani(&[], &labh, &["alamBi", "alABi"]); + assert_has_ta_k(&[], &labh, Lun, &["alamBi", "alABi"]); assert_has_krdanta(&[], &labh, Krt::Ramul, &["lABam", "lamBam"]); // nitya for sopasarga - assert_has_lun_karmani(&["pra"], &labh, &["prAlamBi"]); + assert_has_ta_k(&["pra"], &labh, Lun, &["prAlamBi"]); assert_has_krdanta(&["pra"], &labh, Krt::Ramul, &["pralamBam"]); } @@ -818,7 +821,7 @@ fn sutra_7_1_100() { #[test] fn sutra_7_1_101() { - assert_has_lat_p(&[], &d("kFta~", Curadi), &["kIrtayati"]); + assert_has_tip(&[], &d("kFta~", Curadi), Lat, &["kIrtayati"]); } #[ignore] @@ -826,7 +829,7 @@ fn sutra_7_1_101() { fn sutra_7_1_102() { let pf = d("pF", Juhotyadi); assert_has_krdanta(&[], &pf, Krt::kta, &["pUrta"]); - assert_has_lat_p(&[], &san(&pf), &["pupUrzati"]); - assert_has_lat_p(&[], &san(&d("mf\\N", Tudadi)), &["mumUrzati"]); + assert_has_tip(&[], &san(&pf), Lat, &["pupUrzati"]); + assert_has_tip(&[], &san(&d("mf\\N", Tudadi)), Lat, &["mumUrzati"]); // TODO: others } diff --git a/vidyut-prakriya/tests/kashika_7_2.rs b/vidyut-prakriya/tests/kashika_7_2.rs index 04fb377..67c4fbf 100644 --- a/vidyut-prakriya/tests/kashika_7_2.rs +++ b/vidyut-prakriya/tests/kashika_7_2.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -10,95 +11,100 @@ use vidyut_prakriya::args::*; #[test] fn sutra_7_2_1() { - assert_has_lun_p(&[], &d("ci\\Y", Svadi), &["acEzIt"]); - assert_has_lun_p(&[], &d("RI\\Y", Bhvadi), &["anEzIt"]); - assert_has_lun_p(&[], &d("lUY", Kryadi), &["alAvIt"]); - assert_has_lun_p(&[], &d("pUY", Kryadi), &["apAvIt"]); - assert_has_lun_p(&[], &d("qukf\\Y", Tanadi), &["akArzIt"]); - assert_has_lun_p(&[], &d("hf\\Y", Bhvadi), &["ahArzIt"]); + assert_has_tip(&[], &d("ci\\Y", Svadi), Lun, &["acEzIt"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lun, &["anEzIt"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lun, &["alAvIt"]); + assert_has_tip(&[], &d("pUY", Kryadi), Lun, &["apAvIt"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lun, &["akArzIt"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lun, &["ahArzIt"]); let kutadi = |u| d(u, Tudadi).with_antargana(Some(Antargana::Kutadi)); - assert_has_lun_p(&["ni"], &kutadi("RU"), &["nyanuvIt"]); - assert_has_lun_p(&["ni"], &kutadi("DU"), &["nyaDuvIt"]); + assert_has_tip(&["ni"], &kutadi("RU"), Lun, &["nyanuvIt"]); + assert_has_tip(&["ni"], &kutadi("DU"), Lun, &["nyaDuvIt"]); - assert_has_lun_a(&[], &d("cyu\\N", Bhvadi), &["acyozwa"]); - assert_has_lun_a(&[], &d("plu\\N", Bhvadi), &["aplozwa"]); + assert_has_ta(&[], &d("cyu\\N", Bhvadi), Lun, &["acyozwa"]); + assert_has_ta(&[], &d("plu\\N", Bhvadi), Lun, &["aplozwa"]); } #[test] fn sutra_7_2_2() { - assert_has_lun_p(&[], &d("kzara~", Bhvadi), &["akzArIt"]); - assert_has_lun_p(&[], &d("tsara~", Bhvadi), &["atsArIt"]); - assert_has_lun_p(&[], &d("jvala~", Bhvadi), &["ajvAlIt"]); - assert_has_lun_p(&[], &d("hmala~", Bhvadi), &["ahmAlIt"]); + assert_has_tip(&[], &d("kzara~", Bhvadi), Lun, &["akzArIt"]); + assert_has_tip(&[], &d("tsara~", Bhvadi), Lun, &["atsArIt"]); + assert_has_tip(&[], &d("jvala~", Bhvadi), Lun, &["ajvAlIt"]); + assert_has_tip(&[], &d("hmala~", Bhvadi), Lun, &["ahmAlIt"]); - assert_has_lun_p(&["ni"], &d("Kura~", Tudadi), &["nyaKorIt"]); - assert_has_lun_p(&["ni"], &d("mIla~", Svadi), &["nyamIlIt"]); + assert_has_tip(&["ni"], &d("Kura~", Tudadi), Lun, &["nyaKorIt"]); + assert_has_tip(&["ni"], &d("mIla~", Svadi), Lun, &["nyamIlIt"]); // TODO: awIt, aSIt - assert_has_lun_p(&[], &d("vaBra~", Bhvadi), &["avaBrIt"]); - assert_has_lun_p(&[], &d("Svalla~", Bhvadi), &["aSvallIt"]); + assert_has_tip(&[], &d("vaBra~", Bhvadi), Lun, &["avaBrIt"]); + assert_has_tip(&[], &d("Svalla~", Bhvadi), Lun, &["aSvallIt"]); } #[test] fn sutra_7_2_3() { - assert_has_lun_p(&[], &d("vada~", Bhvadi), &["avAdIt"]); - assert_has_lun_p(&[], &d("vraja~", Bhvadi), &["avrAjIt"]); - assert_has_lun_p(&[], &d("Bi\\di~^r", Rudhadi), &["aBEtsIt", "aBidat"]); - assert_has_lun_p(&[], &d("Ci\\di~^r", Rudhadi), &["acCEtsIt", "acCidat"]); - assert_has_lun_p(&[], &d("ru\\Di~^r", Rudhadi), &["arOtsIt", "aruDat"]); - assert_has_lun_p(&[], &d("ra\\nja~^", Bhvadi), &["arANkzIt"]); - assert_has_lun_p(&[], &d("za\\nja~", Bhvadi), &["asANkzIt"]); + assert_has_tip(&[], &d("vada~", Bhvadi), Lun, &["avAdIt"]); + assert_has_tip(&[], &d("vraja~", Bhvadi), Lun, &["avrAjIt"]); + assert_has_tip(&[], &d("Bi\\di~^r", Rudhadi), Lun, &["aBEtsIt", "aBidat"]); + assert_has_tip(&[], &d("Ci\\di~^r", Rudhadi), Lun, &["acCEtsIt", "acCidat"]); + assert_has_tip(&[], &d("ru\\Di~^r", Rudhadi), Lun, &["arOtsIt", "aruDat"]); + assert_has_tip(&[], &d("ra\\nja~^", Bhvadi), Lun, &["arANkzIt"]); + assert_has_tip(&[], &d("za\\nja~", Bhvadi), Lun, &["asANkzIt"]); assert_has_tas(&["ud"], &d("va\\ha~^", Bhvadi), Lakara::Lun, &["udavoQAm"]); } #[test] fn sutra_7_2_4() { - assert_has_lun_p(&[], &d("divu~", Divadi), &["adevIt"]); - assert_has_lun_p(&[], &d("zivu~", Divadi), &["asevIt"]); - assert_has_lun_p(&[], &d("kuza~", Kryadi), &["akozIt"]); - assert_has_lun_p(&[], &d("muza~", Kryadi), &["amozIt"]); - assert_has_lun_p(&[], &d("lUY", Kryadi), &["alAvIt"]); + assert_has_tip(&[], &d("divu~", Divadi), Lun, &["adevIt"]); + assert_has_tip(&[], &d("zivu~", Divadi), Lun, &["asevIt"]); + assert_has_tip(&[], &d("kuza~", Kryadi), Lun, &["akozIt"]); + assert_has_tip(&[], &d("muza~", Kryadi), Lun, &["amozIt"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lun, &["alAvIt"]); } #[test] fn sutra_7_2_5() { - assert_has_lun_p(&[], &d("graha~^", Kryadi), &["agrahIt"]); - assert_has_lun_p(&[], &d("syamu~", Divadi), &["asyamIt"]); - assert_has_lun_p(&[], &d("vyaya~^", Bhvadi), &["avyayIt"]); - assert_has_lun_p(&[], &d("wuvama~", Bhvadi), &["avamIt"]); - assert_has_lun_p(&[], &d("kzaRu~^", Kryadi), &["akzaRIt"]); - assert_has_lun_p(&[], &d("Svasa~", Adadi), &["aSvasIt"]); - assert_has_lun_p(&[], &d("jAgf", Adadi), &["ajAgarIt"]); - assert_has_lun_p(&[], &d("rage~", Bhvadi), &["aragIt"]); - assert_has_lun_p(&[], &d("kaKe~", Kryadi), &["akaKIt"]); + assert_has_tip(&[], &d("graha~^", Kryadi), Lun, &["agrahIt"]); + assert_has_tip(&[], &d("syamu~", Divadi), Lun, &["asyamIt"]); + assert_has_tip(&[], &d("vyaya~^", Bhvadi), Lun, &["avyayIt"]); + assert_has_tip(&[], &d("wuvama~", Bhvadi), Lun, &["avamIt"]); + assert_has_tip(&[], &d("kzaRu~^", Kryadi), Lun, &["akzaRIt"]); + assert_has_tip(&[], &d("Svasa~", Adadi), Lun, &["aSvasIt"]); + assert_has_tip(&[], &d("jAgf", Adadi), Lun, &["ajAgarIt"]); + assert_has_tip(&[], &d("rage~", Bhvadi), Lun, &["aragIt"]); + assert_has_tip(&[], &d("kaKe~", Kryadi), Lun, &["akaKIt"]); // Ignore OnayIt and aSvayIt, which are chAndasa forms. } #[test] fn sutra_7_2_6() { let urnu = d("UrRuY", Adadi); - assert_has_lun_p(&["pra"], &urnu, &["prOrRavIt", "prOrRAvIt", "prOrRuvIt"]); + assert_has_tip( + &["pra"], + &urnu, + Lun, + &["prOrRavIt", "prOrRAvIt", "prOrRuvIt"], + ); } #[test] fn sutra_7_2_7() { - assert_has_lun_p(&[], &d("kaRa~", Bhvadi), &["akaRIt", "akARIt"]); - assert_has_lun_p(&[], &d("raRa~", Bhvadi), &["araRIt", "arARIt"]); + assert_has_tip(&[], &d("kaRa~", Bhvadi), Lun, &["akaRIt", "akARIt"]); + assert_has_tip(&[], &d("raRa~", Bhvadi), Lun, &["araRIt", "arARIt"]); let kuw = d("kuwa~", Tudadi).with_antargana(Some(Antargana::Kutadi)); let puw = d("puwa~", Tudadi).with_antargana(Some(Antargana::Kutadi)); // Various counterexamples - assert_has_lun_p(&[], &d("divu~", Divadi), &["adevIt"]); - assert_has_lun_p(&[], &d("zivu~", Divadi), &["asevIt"]); - assert_has_lun_p(&["ni"], &kuw, &["nyakuwIt"]); - assert_has_lun_p(&["ni"], &puw, &["nyapuwIt"]); - assert_has_lun_p(&[], &d("takza~", Bhvadi), &["atakzIt"]); - assert_has_lun_p(&[], &d("rakza~", Divadi), &["arakzIt"]); - assert_has_lun_p(&[], &d("cakAsf~", Adadi), &["acakAsIt"]); - assert_has_lun_p(&[], &d("qupa\\ca~^z", Bhvadi), &["apAkzIt"]); + assert_has_tip(&[], &d("divu~", Divadi), Lun, &["adevIt"]); + assert_has_tip(&[], &d("zivu~", Divadi), Lun, &["asevIt"]); + assert_has_tip(&["ni"], &kuw, Lun, &["nyakuwIt"]); + assert_has_tip(&["ni"], &puw, Lun, &["nyapuwIt"]); + assert_has_tip(&[], &d("takza~", Bhvadi), Lun, &["atakzIt"]); + assert_has_tip(&[], &d("rakza~", Divadi), Lun, &["arakzIt"]); + assert_has_tip(&[], &d("cakAsf~", Adadi), Lun, &["acakAsIt"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lun, &["apAkzIt"]); // TODO: aSIt, awIt } @@ -139,30 +145,30 @@ fn sutra_7_2_9() { let sac = d("zaca~\\", Bhvadi); assert_has_krdanta(&[], &sac, Krt::tfc, &["sacitf"]); assert_has_krdanta(&[], &sac, Krt::tumun, &["sacitum"]); - assert_has_krdanta(&[], &sac, Krt::tun, &["saktu"]); + assert_has_krdanta(&[], &sac, Unadi::tun, &["saktu"]); // zwran let pat = d("patx~", Bhvadi); assert_has_krdanta(&[], &pat, Krt::tfc, &["patitf"]); assert_has_krdanta(&[], &pat, Krt::tumun, &["patitum"]); - assert_has_krdanta(&[], &pat, Krt::zwran, &["pattra"]); - assert_has_krdanta(&[], &tan, Krt::zwran, &["tantra"]); + assert_has_krdanta(&[], &pat, Unadi::zwran, &["pattra"]); + assert_has_krdanta(&[], &tan, Unadi::zwran, &["tantra"]); // tan let has = d("hase~", Bhvadi); assert_has_krdanta(&[], &has, Krt::tfc, &["hasitf"]); assert_has_krdanta(&[], &has, Krt::tumun, &["hasitum"]); - assert_has_krdanta(&[], &has, Krt::tan, &["hasta"]); + assert_has_krdanta(&[], &has, Unadi::tan, &["hasta"]); let lu = d("lUY", Kryadi); assert_has_krdanta(&[], &lu, Krt::tfc, &["lavitf"]); assert_has_krdanta(&[], &lu, Krt::tumun, &["lavitum"]); - assert_has_krdanta(&[], &lu, Krt::tan, &["lota"]); + assert_has_krdanta(&[], &lu, Unadi::tan, &["lota"]); let pu = d("pUY", Kryadi); assert_has_krdanta(&[], &pu, Krt::tfc, &["pavitf"]); assert_has_krdanta(&[], &pu, Krt::tumun, &["pavitum"]); - assert_has_krdanta(&[], &pu, Krt::tan, &["pota"]); + assert_has_krdanta(&[], &pu, Unadi::tan, &["pota"]); let dhurv = d("DurvI~", Kryadi); assert_has_krdanta(&[], &dhurv, Krt::tfc, &["DUrvitf"]); @@ -177,39 +183,39 @@ fn sutra_7_2_9() { let kuz = d("kuza~", Bhvadi); assert_has_krdanta(&[], &kuz, Krt::tfc, &["kozitf"]); assert_has_krdanta(&[], &kuz, Krt::tumun, &["kozitum"]); - assert_has_krdanta(&[], &kuz, Krt::kTan, &["kuzWa"]); + assert_has_krdanta(&[], &kuz, Unadi::kTan, &["kuzWa"]); let kash = d("kASf~", Bhvadi); assert_has_krdanta(&[], &kash, Krt::tfc, &["kASitf"]); assert_has_krdanta(&[], &kash, Krt::tumun, &["kASitum"]); - assert_has_krdanta(&[], &kash, Krt::kTan, &["kAzWa"]); + assert_has_krdanta(&[], &kash, Unadi::kTan, &["kAzWa"]); // ksi - assert_has_krdanta(&[], &kuz, Krt::ksi, &["kukzi"]); + assert_has_krdanta(&[], &kuz, Unadi::ksi, &["kukzi"]); // suk let iz = d("izu~", Tudadi); assert_has_krdanta(&[], &iz, Krt::tfc, &["ezitf", "ezwf"]); assert_has_krdanta(&[], &iz, Krt::tumun, &["ezitum", "ezwum"]); - assert_has_krdanta(&[], &iz, Krt::ksu, &["ikzu"]); + assert_has_krdanta(&[], &iz, Unadi::ksu, &["ikzu"]); // kzaran let ash = d("aSU~\\", Svadi); assert_has_krdanta(&[], &ash, Krt::tfc, &["aSitf", "azwf"]); assert_has_krdanta(&[], &ash, Krt::tumun, &["aSitum", "azwum"]); - assert_has_krdanta(&[], &ash, Krt::sara, &["akzara"]); + assert_has_krdanta(&[], &ash, Unadi::sara, &["akzara"]); // kan let shal = d("Sala~", Bhvadi); assert_has_krdanta(&[], &shal, Krt::tfc, &["Salitf"]); assert_has_krdanta(&[], &shal, Krt::tumun, &["Salitum"]); - assert_has_krdanta(&[], &shal, Krt::kan, &["Salka"]); + assert_has_krdanta(&[], &shal, Unadi::kan, &["Salka"]); // sa let vad = d("vada~", Svadi); assert_has_krdanta(&[], &vad, Krt::tfc, &["vaditf"]); assert_has_krdanta(&[], &vad, Krt::tumun, &["vaditum"]); - assert_has_krdanta(&[], &vad, Krt::sa, &["vatsa"]); + assert_has_krdanta(&[], &vad, Unadi::sa, &["vatsa"]); // kfti? assert_has_lat(&[], &d("rudi~r", Adadi), &["roditi"]); @@ -408,10 +414,10 @@ fn sutra_7_2_11() { #[test] fn sutra_7_2_12() { - assert_has_lat_p(&[], &san(&d("graha~^", Kryadi)), &["jiGfkzati"]); - assert_has_lat_p(&[], &san(&d("guhU~^", Bhvadi)), &["juGukzati"]); - assert_has_lat_p(&[], &san(&d("ru", Adadi)), &["rurUzati"]); - assert_has_lat_p(&[], &san(&d("lUY", Kryadi)), &["lulUzati"]); + assert_has_tip(&[], &san(&d("graha~^", Kryadi)), Lat, &["jiGfkzati"]); + assert_has_tip(&[], &san(&d("guhU~^", Bhvadi)), Lat, &["juGukzati"]); + assert_has_tip(&[], &san(&d("ru", Adadi)), Lat, &["rurUzati"]); + assert_has_tip(&[], &san(&d("lUY", Kryadi)), Lat, &["lulUzati"]); } #[test] @@ -555,11 +561,11 @@ fn sutra_7_2_36() { assert_has_krdanta(&["pra"], &kram, Krt::tavya, &["prakramitavya"]); // anAtmanepadanimitte - assert_has_ashirlin_karmani(&["pra"], &snu, &["prasnozIzwa", "prasnAvizIzwa"]); - assert_has_ashirlin_karmani(&["pra"], &kram, &["prakraMsIzwa"]); - assert_has_lrt_karmani(&["pra"], &snu, &["prasnozyate", "prasnAvizyate"]); - assert_has_lrt_karmani(&["pra"], &kram, &["prakraMsyate"]); - assert_has_lrt_karmani(&["pra"], &san(&snu), &["prasusnUzizyate"]); + assert_has_ta_k(&["pra"], &snu, AshirLin, &["prasnozIzwa", "prasnAvizIzwa"]); + assert_has_ta_k(&["pra"], &kram, AshirLin, &["prakraMsIzwa"]); + assert_has_ta_k(&["pra"], &snu, Lrt, &["prasnozyate", "prasnAvizyate"]); + assert_has_ta_k(&["pra"], &kram, Lrt, &["prakraMsyate"]); + assert_has_ta_k(&["pra"], &san(&snu), Lrt, &["prasusnUzizyate"]); // TODO: we produce pracikramizizyate instead // assert_has_lrt_karmani(&["pra"], &san(&kram), &["pracikraMsizyate"]); } @@ -571,8 +577,8 @@ fn sutra_7_2_37() { assert_has_krdanta(&[], &grah, Krt::tumun, &["grahItum"]); assert_has_krdanta(&[], &grah, Krt::tavya, &["grahItavya"]); assert_has_vas(&[], &grah, Lit, &["jagfhiva"]); - assert_has_lut_karmani(&[], &grah, &["grAhitA", "grahItA"]); - assert_has_lrt_karmani(&[], &grah, &["grAhizyate", "grahIzyate"]); + assert_has_ta_k(&[], &grah, Lut, &["grAhitA", "grahItA"]); + assert_has_ta_k(&[], &grah, Lrt, &["grAhizyate", "grahIzyate"]); } #[test] @@ -591,8 +597,8 @@ fn sutra_7_2_38() { &["Astaritf", "AstarItf"], ); // vFtaH? - assert_has_lrt_p(&[], &d("qukf\\Y", Tanadi), &["karizyati"]); - assert_has_lrt_p(&[], &d("hf\\Y", Bhvadi), &["harizyati"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lrt, &["karizyati"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lrt, &["harizyati"]); // aliwi assert_has_sip(&[], &d("vF", Kryadi), Lit, &["vavariTa"]); assert_has_sip(&[], &tf, Lit, &["teriTa"]); @@ -731,9 +737,10 @@ fn sutra_7_2_49() { #[ignore] #[test] fn sutra_7_2_49_v1() { - assert_has_lat_p( + assert_has_tip( &[], &san(&d("tanu~^", Tanadi)), + Lat, &["titanizati", "titaMsati", "titAMsati"], ); assert_has_lat(&[], &san(&d("patx~", Bhvadi)), &["pipatizati", "pitsati"]); @@ -803,44 +810,44 @@ fn sutra_7_2_56() { #[test] fn sutra_7_2_57() { let kft = d("kftI~", Tudadi); - assert_has_lrt_p(&[], &kft, &["kartsyati", "kartizyati"]); - assert_has_lat_p(&[], &san(&kft), &["cikftsati", "cikartizati"]); - assert_has_lrn_p(&[], &kft, &["akartsyat", "akartizyat"]); + assert_has_tip(&[], &kft, Lrt, &["kartsyati", "kartizyati"]); + assert_has_tip(&[], &san(&kft), Lat, &["cikftsati", "cikartizati"]); + assert_has_tip(&[], &kft, Lrn, &["akartsyat", "akartizyat"]); let kft = d("kftI~", Rudhadi); - assert_has_lrt_p(&[], &kft, &["kartsyati", "kartizyati"]); - assert_has_lat_p(&[], &san(&kft), &["cikftsati", "cikartizati"]); - assert_has_lrn_p(&[], &kft, &["akartsyat", "akartizyat"]); + assert_has_tip(&[], &kft, Lrt, &["kartsyati", "kartizyati"]); + assert_has_tip(&[], &san(&kft), Lat, &["cikftsati", "cikartizati"]); + assert_has_tip(&[], &kft, Lrn, &["akartsyat", "akartizyat"]); let cft = d("cftI~", Tudadi); - assert_has_lrt_p(&[], &cft, &["cartsyati", "cartizyati"]); - assert_has_lat_p(&[], &san(&cft), &["cicftsati", "cicartizati"]); - assert_has_lrn_p(&[], &cft, &["acartsyat", "acartizyat"]); + assert_has_tip(&[], &cft, Lrt, &["cartsyati", "cartizyati"]); + assert_has_tip(&[], &san(&cft), Lat, &["cicftsati", "cicartizati"]); + assert_has_tip(&[], &cft, Lrn, &["acartsyat", "acartizyat"]); let chfd = d("u~Cfdi~^r", Rudhadi); - assert_has_lrt_p(&[], &chfd, &["Cartsyati", "Cardizyati"]); - assert_has_lat_p(&[], &san(&chfd), &["cicCftsati", "cicCardizati"]); - assert_has_lrn_p(&[], &chfd, &["acCartsyat", "acCardizyat"]); + assert_has_tip(&[], &chfd, Lrt, &["Cartsyati", "Cardizyati"]); + assert_has_tip(&[], &san(&chfd), Lat, &["cicCftsati", "cicCardizati"]); + assert_has_tip(&[], &chfd, Lrn, &["acCartsyat", "acCardizyat"]); let tfd = d("u~tfdi~^r", Rudhadi); - assert_has_lrt_p(&[], &tfd, &["tartsyati", "tardizyati"]); - assert_has_lat_p(&[], &san(&tfd), &["titftsati", "titardizati"]); - assert_has_lrn_p(&[], &tfd, &["atartsyat", "atardizyat"]); + assert_has_tip(&[], &tfd, Lrt, &["tartsyati", "tardizyati"]); + assert_has_tip(&[], &san(&tfd), Lat, &["titftsati", "titardizati"]); + assert_has_tip(&[], &tfd, Lrn, &["atartsyat", "atardizyat"]); let nft = d("nftI~", Divadi); - assert_has_lrt_p(&[], &nft, &["nartsyati", "nartizyati"]); - assert_has_lat_p(&[], &san(&nft), &["ninftsati", "ninartizati"]); - assert_has_lrn_p(&[], &nft, &["anartsyat", "anartizyat"]); + assert_has_tip(&[], &nft, Lrt, &["nartsyati", "nartizyati"]); + assert_has_tip(&[], &san(&nft), Lat, &["ninftsati", "ninartizati"]); + assert_has_tip(&[], &nft, Lrn, &["anartsyat", "anartizyat"]); } #[ignore] #[test] fn sutra_7_2_58() { let gam = d("ga\\mx~", Bhvadi); - assert_has_lrt_p(&[], &gam, &["gamizyati"]); - assert_has_lrn_p(&[], &gam, &["agamizyat"]); - assert_has_lat_p(&[], &san(&gam), &["jigamizati"]); + assert_has_tip(&[], &gam, Lrt, &["gamizyati"]); + assert_has_tip(&[], &gam, Lrn, &["agamizyat"]); + assert_has_tip(&[], &san(&gam), Lat, &["jigamizati"]); // gameH - assert_has_lrt_p(&[], &d("ci\\Y", Svadi), &["cezyati"]); + assert_has_tip(&[], &d("ci\\Y", Svadi), Lrt, &["cezyati"]); // parasmEpadezu assert_has_ashirlin(&["sam"], &gam, &["saNgaMsIzwa"]); assert_has_lrt(&["sam"], &gam, &["saNgaMsyate"]); @@ -879,10 +886,10 @@ fn sutra_7_2_59() { #[test] fn sutra_7_2_60() { let kfp = d("kfpU~\\", Bhvadi); - assert_has_lut_p(&[], &kfp, &["kalptA"]); - assert_has_lrt_p(&[], &kfp, &["kalpsyati"]); - assert_has_lrn_p(&[], &kfp, &["akalpsyat"]); - assert_has_lat_p(&[], &san(&kfp), &["cikxpsati"]); + assert_has_tip(&[], &kfp, Lut, &["kalptA"]); + assert_has_tip(&[], &kfp, Lrt, &["kalpsyati"]); + assert_has_tip(&[], &kfp, Lrn, &["akalpsyat"]); + assert_has_tip(&[], &san(&kfp), Lat, &["cikxpsati"]); // parasmaipadezu assert_has_tinanta( &[], @@ -892,10 +899,10 @@ fn sutra_7_2_60() { Eka, &["kalptAsi", "kalptAse", "kalpitAse"], ); - assert_has_lrt_a(&[], &kfp, &["kalpizyate", "kalpsyate"]); - assert_has_ashirlin_a(&[], &kfp, &["kalpizIzwa", "kxpsIzwa"]); - assert_has_lrn_a(&[], &kfp, &["akalpizyata", "akalpsyata"]); - assert_has_lat_a(&[], &san(&kfp), &["cikalpizate", "cikxpsate"]); + assert_has_ta(&[], &kfp, Lrt, &["kalpizyate", "kalpsyate"]); + assert_has_ta(&[], &kfp, AshirLin, &["kalpizIzwa", "kxpsIzwa"]); + assert_has_ta(&[], &kfp, Lrn, &["akalpizyata", "akalpsyata"]); + assert_has_ta(&[], &san(&kfp), Lat, &["cikalpizate", "cikxpsate"]); } #[test] @@ -1011,10 +1018,10 @@ fn sutra_7_2_68() { #[test] fn sutra_7_2_70() { - assert_has_lrt_p(&[], &d("qukf\\Y", Tanadi), &["karizyati"]); - assert_has_lrt_p(&[], &d("hf\\Y", Bhvadi), &["harizyati"]); - assert_has_lrt_p(&[], &d("ha\\na~", Adadi), &["hanizyati"]); - assert_has_lrt_p(&[], &d("svf", Bhvadi), &["svarizyati"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lrt, &["karizyati"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lrt, &["harizyati"]); + assert_has_tip(&[], &d("ha\\na~", Adadi), Lrt, &["hanizyati"]); + assert_has_tip(&[], &d("svf", Bhvadi), Lrt, &["svarizyati"]); } #[test] @@ -1030,13 +1037,13 @@ fn sutra_7_2_72() { let su = d("zu\\Y", Svadi); let dhu = d("DUY", Svadi); - assert_has_lun_p(&[], &stu, &["astAvIt"]); - assert_has_lun_p(&[], &su, &["asAvIt"]); - assert_has_lun_p(&[], &dhu, &["aDAvIt"]); + assert_has_tip(&[], &stu, Lun, &["astAvIt"]); + assert_has_tip(&[], &su, Lun, &["asAvIt"]); + assert_has_tip(&[], &dhu, Lun, &["aDAvIt"]); - assert_has_lun_a(&[], &stu, &["astozwa"]); - assert_has_lun_a(&[], &su, &["asozwa"]); - assert_has_lun_a(&[], &dhu, &["aDozwa", "aDavizwa"]); + assert_has_ta(&[], &stu, Lun, &["astozwa"]); + assert_has_ta(&[], &su, Lun, &["asozwa"]); + assert_has_ta(&[], &dhu, Lun, &["aDozwa", "aDavizwa"]); } #[test] @@ -1046,14 +1053,14 @@ fn sutra_7_2_73() { let nam = d("Ra\\ma~", Bhvadi); let yaa = d("yA\\", Adadi); - assert_has_lun_p(&[], &yam, &["ayaMsIt"]); - assert_has_lun_p(&["vi"], &ram, &["vyaraMsIt"]); + assert_has_tip(&[], &yam, Lun, &["ayaMsIt"]); + assert_has_tip(&["vi"], &ram, Lun, &["vyaraMsIt"]); assert_has_lun(&[], &nam, &["anaMsIt"]); - assert_has_lun_p(&[], &yaa, &["ayAsIt"]); + assert_has_tip(&[], &yaa, Lun, &["ayAsIt"]); // TODO: not sure how to derive ayaMsta and anaMsta // assert_has_lun_karmani(&[], &yam, &["ayaMsta"]); - assert_has_lun_a(&[], &ram, &["araMsta"]); + assert_has_ta(&[], &ram, Lun, &["araMsta"]); // assert_has_lun_karmani(&[], &nam, &["anaMsta"]); } @@ -1093,13 +1100,13 @@ fn sutra_7_2_76() { let rud = d("rudi~r", Adadi); let svap = d("Yizva\\pa~", Adadi); - assert_has_lat_p(&[], &rud, &["roditi"]); - assert_has_lat_p(&[], &svap, &["svapiti"]); - assert_has_lat_p(&[], &d("Svasa~", Adadi), &["Svasiti"]); - assert_has_lat_p(&["pra"], &d("ana~", Adadi), &["prARiti"]); - assert_has_lat_p(&[], &d("jakza~", Adadi), &["jakziti"]); + assert_has_tip(&[], &rud, Lat, &["roditi"]); + assert_has_tip(&[], &svap, Lat, &["svapiti"]); + assert_has_tip(&[], &d("Svasa~", Adadi), Lat, &["Svasiti"]); + assert_has_tip(&["pra"], &d("ana~", Adadi), Lat, &["prARiti"]); + assert_has_tip(&[], &d("jakza~", Adadi), Lat, &["jakziti"]); - assert_has_lat_p(&[], &d("jAgf", Adadi), &["jAgarti"]); + assert_has_tip(&[], &d("jAgf", Adadi), Lat, &["jAgarti"]); assert_has_krdanta(&[], &svap, Krt::tfc, &["svaptf"]); assert_has_jhi(&[], &rud, Lakara::Lat, &["rudanti"]); } @@ -1155,10 +1162,10 @@ fn sutra_7_2_79() { #[test] fn sutra_7_2_80() { - assert_has_vidhilin_p(&[], &d("qupa\\ca~^z", Bhvadi), &["pacet"]); - assert_has_vidhilin_p(&[], &d("ci\\Y", Svadi), &["cinuyAt"]); - assert_has_vidhilin_p(&[], &d("zu\\Y", Svadi), &["sunuyAt"]); - assert_has_vidhilin_p(&[], &d("yA\\", Adadi), &["yAyAt"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), VidhiLin, &["pacet"]); + assert_has_tip(&[], &d("ci\\Y", Svadi), VidhiLin, &["cinuyAt"]); + assert_has_tip(&[], &d("zu\\Y", Svadi), VidhiLin, &["sunuyAt"]); + assert_has_tip(&[], &d("yA\\", Adadi), VidhiLin, &["yAyAt"]); let _cikirs = d("qukf\\Y", Tanadi).with_sanadi(&[Sanadi::San]); // TODO: cikIrzyAt @@ -1509,18 +1516,18 @@ fn sutra_7_2_116() { assert_has_krdanta(&[], &pac, Krt::GaY, &["pAka"]); assert_has_krdanta(&[], &d("tya\\ja~", Bhvadi), Krt::GaY, &["tyAga"]); assert_has_krdanta(&[], &d("ya\\ja~^", Bhvadi), Krt::GaY, &["yAga"]); - assert_has_lat_p(&[], &nic(&pac), &["pAcayati"]); + assert_has_tip(&[], &nic(&pac), Lat, &["pAcayati"]); assert_has_krdanta(&[], &pac, Krt::Rvul, &["pAcaka"]); let path = d("paWa~", Bhvadi); - assert_has_lat_p(&[], &nic(&path), &["pAWayati"]); + assert_has_tip(&[], &nic(&path), Lat, &["pAWayati"]); assert_has_krdanta(&[], &path, Krt::Rvul, &["pAWaka"]); // ataH let bhid = d("Bi\\di~^r", Rudhadi); - assert_has_lat_p(&[], &nic(&bhid), &["Bedayati"]); + assert_has_tip(&[], &nic(&bhid), Lat, &["Bedayati"]); assert_has_krdanta(&[], &bhid, Krt::Rvul, &["Bedaka"]); // upadhAyAH - assert_has_lat_p(&[], &nic(&d("cakAsf~", Adadi)), &["cakAsayati"]); + assert_has_tip(&[], &nic(&d("cakAsf~", Adadi)), Lat, &["cakAsayati"]); assert_has_krdanta(&[], &d("takza~", Bhvadi), Krt::Rvul, &["takzaka"]); } diff --git a/vidyut-prakriya/tests/kashika_7_3.rs b/vidyut-prakriya/tests/kashika_7_3.rs index f89d946..6cbeecf 100644 --- a/vidyut-prakriya/tests/kashika_7_3.rs +++ b/vidyut-prakriya/tests/kashika_7_3.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -44,31 +45,31 @@ fn sutra_7_3_4() { fn sutra_7_3_32() { let han = d("ha\\na~", Adadi); - assert_has_lat_p(&[], &nic(&han), &["GAtayati"]); + assert_has_tip(&[], &nic(&han), Lat, &["GAtayati"]); assert_has_krdanta(&[], &han, Krt::Rvul, &["GAtaka"]); assert_has_krdanta(&[], &han, Krt::GaY, &["GAta"]); assert_has_krdanta(&[], &han, Krt::Rini, &["GAtin"]); assert_has_krdanta(&[], &han, Krt::Ramul, &["GAtam"]); // a-ciR-Ramul - assert_has_lun_karmani(&[], &han, &["aGAni", "avaDi"]); - assert_has_lit_p(&[], &han, &["jaGAna"]); + assert_has_ta_k(&[], &han, Lun, &["aGAni", "avaDi"]); + assert_has_tip(&[], &han, Lit, &["jaGAna"]); } #[test] fn sutra_7_3_33() { let daa = d("qudA\\Y", Juhotyadi); - assert_has_lun_karmani(&[], &daa, &["adAyi"]); + assert_has_ta_k(&[], &daa, Lun, &["adAyi"]); let dhaa = d("quDA\\Y", Juhotyadi); - assert_has_lun_karmani(&[], &dhaa, &["aDAyi"]); + assert_has_ta_k(&[], &dhaa, Lun, &["aDAyi"]); assert_has_krdanta(&[], &daa, Krt::GaY, &["dAya"]); assert_has_krdanta(&[], &daa, Krt::Rvul, &["dAyaka"]); assert_has_krdanta(&[], &dhaa, Krt::GaY, &["DAya"]); assert_has_krdanta(&[], &dhaa, Krt::Rvul, &["DAyaka"]); // ciN-kft - assert_has_lit_p(&[], &daa, &["dadO"]); - assert_has_lit_p(&[], &dhaa, &["daDO"]); + assert_has_tip(&[], &daa, Lit, &["dadO"]); + assert_has_tip(&[], &dhaa, Lit, &["daDO"]); } #[test] @@ -76,9 +77,9 @@ fn sutra_7_3_34() { let sham = d("Samu~", Divadi); let tam = d("tamu~", Divadi); let dam = d("damu~", Divadi); - assert_has_lun_karmani(&[], &sham, &["aSami"]); - assert_has_lun_karmani(&[], &tam, &["atami"]); - assert_has_lun_karmani(&[], &dam, &["adami"]); + assert_has_ta_k(&[], &sham, Lun, &["aSami"]); + assert_has_ta_k(&[], &tam, Lun, &["atami"]); + assert_has_ta_k(&[], &dam, Lun, &["adami"]); assert_has_krdanta(&[], &sham, Krt::Rvul, &["Samaka"]); assert_has_krdanta(&[], &tam, Krt::Rvul, &["tamaka"]); assert_has_krdanta(&[], &dam, Krt::Rvul, &["damaka"]); @@ -104,7 +105,7 @@ fn sutra_7_3_34() { #[test] fn sutra_7_3_35() { let jan = d("janI~\\", Divadi); - assert_has_lun_karmani(&[], &jan, &["ajani", "ajanizwa"]); + assert_has_ta_k(&[], &jan, Lun, &["ajani", "ajanizwa"]); assert_has_krdanta(&[], &jan, Krt::Rvul, &["janaka"]); assert_has_krdanta(&["pra"], &jan, Krt::GaY, &["prajana"]); // TODO: vadh -- not in dhatupatha? @@ -112,60 +113,68 @@ fn sutra_7_3_35() { #[test] fn sutra_7_3_36() { - assert_has_lat_p(&[], &nic_d("f\\", Bhvadi), &["arpayati"]); - assert_has_lat_p(&[], &nic_d("f\\", Juhotyadi), &["arpayati"]); - assert_has_lat_p(&[], &nic_d("hrI\\", Juhotyadi), &["hrepayati"]); - assert_has_lat_p(&[], &nic_d("vlI\\", Kryadi), &["vlepayati"]); - assert_has_lat_p(&[], &nic_d("rI\\N", Divadi), &["repayati"]); - assert_has_lat_p(&[], &nic_d("rI\\", Kryadi), &["repayati"]); - assert_has_lat_p(&[], &nic_d("knUyI~\\", Bhvadi), &["knopayati"]); - assert_has_lat_p(&[], &nic_d("kzmAyI~\\", Bhvadi), &["kzmApayati"]); - assert_has_lat_p(&[], &nic_d("qudA\\Y", Bhvadi), &["dApayati"]); - assert_has_lat_p(&[], &nic_d("quDA\\Y", Bhvadi), &["DApayati"]); + assert_has_tip(&[], &nic_d("f\\", Bhvadi), Lat, &["arpayati"]); + assert_has_tip(&[], &nic_d("f\\", Juhotyadi), Lat, &["arpayati"]); + assert_has_tip(&[], &nic_d("hrI\\", Juhotyadi), Lat, &["hrepayati"]); + assert_has_tip(&[], &nic_d("vlI\\", Kryadi), Lat, &["vlepayati"]); + assert_has_tip(&[], &nic_d("rI\\N", Divadi), Lat, &["repayati"]); + assert_has_tip(&[], &nic_d("rI\\", Kryadi), Lat, &["repayati"]); + assert_has_tip(&[], &nic_d("knUyI~\\", Bhvadi), Lat, &["knopayati"]); + assert_has_tip(&[], &nic_d("kzmAyI~\\", Bhvadi), Lat, &["kzmApayati"]); + assert_has_tip(&[], &nic_d("qudA\\Y", Bhvadi), Lat, &["dApayati"]); + assert_has_tip(&[], &nic_d("quDA\\Y", Bhvadi), Lat, &["DApayati"]); } #[test] fn sutra_7_3_37() { - assert_has_lat_p(&[], &nic_d("So\\", Divadi), &["SAyayati"]); - assert_has_lat_p(&["ava"], &nic_d("Co\\", Divadi), &["avacCAyayati"]); - assert_has_lat_p(&["ava"], &nic_d("zE\\", Bhvadi), &["avasAyayati"]); - assert_has_lat_p(&[], &nic_d("hve\\Y", Kryadi), &["hvAyayati"]); - assert_has_lat_p(&["sam"], &nic_d("vye\\Y", Divadi), &["saMvyAyayati"]); - assert_has_lat_p(&[], &nic_d("pA\\", Bhvadi), &["pAyayati"]); - assert_has_lat_p(&[], &nic_d("pE\\", Bhvadi), &["pAyayati"]); + assert_has_tip(&[], &nic_d("So\\", Divadi), Lat, &["SAyayati"]); + assert_has_tip(&["ava"], &nic_d("Co\\", Divadi), Lat, &["avacCAyayati"]); + assert_has_tip(&["ava"], &nic_d("zE\\", Bhvadi), Lat, &["avasAyayati"]); + assert_has_tip(&[], &nic_d("hve\\Y", Kryadi), Lat, &["hvAyayati"]); + assert_has_tip(&["sam"], &nic_d("vye\\Y", Divadi), Lat, &["saMvyAyayati"]); + assert_has_tip(&[], &nic_d("pA\\", Bhvadi), Lat, &["pAyayati"]); + assert_has_tip(&[], &nic_d("pE\\", Bhvadi), Lat, &["pAyayati"]); } #[test] fn sutra_7_3_37_v1() { - assert_has_lat_p(&[], &nic_d("pA\\", Adadi), &["pAlayati"]); + assert_has_tip(&[], &nic_d("pA\\", Adadi), Lat, &["pAlayati"]); } #[test] fn sutra_7_3_37_v2() { - assert_has_lat_p(&[], &nic_d("DUY", Svadi), &["DUnayati", "DAvayati"]); - assert_has_lat_p(&[], &nic_d("prI\\Y", Kryadi), &["prIRayati", "prAyayati"]); + assert_has_tip(&[], &nic_d("DUY", Svadi), Lat, &["DUnayati", "DAvayati"]); + assert_has_tip( + &[], + &nic_d("prI\\Y", Kryadi), + Lat, + &["prIRayati", "prAyayati"], + ); } #[test] fn sutra_7_3_38() { - assert_has_lat_p(&[], &nic_d("vA\\", Adadi), &["vAjayati", "vApayati"]); + assert_has_tip(&[], &nic_d("vA\\", Adadi), Lat, &["vAjayati", "vApayati"]); } #[test] fn sutra_7_3_39() { - assert_has_lat_p( + assert_has_tip( &["vi"], &nic_d("lI\\N", Divadi), + Lat, &["vilInayati", "vilAyayati", "vilAlayati", "vilApayati"], ); - assert_has_lat_p( + assert_has_tip( &["vi"], &nic_d("lI\\", Kryadi), + Lat, &["vilInayati", "vilAyayati", "vilAlayati", "vilApayati"], ); - assert_has_lat_p( + assert_has_tip( &["vi"], &nic_d("lA\\", Adadi), + Lat, &["vilAlayati", "vilApayati"], ); } @@ -181,17 +190,27 @@ fn sutra_7_3_40() { #[test] fn sutra_7_3_41() { - assert_has_lat_p(&[], &nic_d("sPAyI~\\", Bhvadi), &["sPAvayati"]); + assert_has_tip(&[], &nic_d("sPAyI~\\", Bhvadi), Lat, &["sPAvayati"]); } #[test] fn sutra_7_3_42() { - assert_has_lat_p(&[], &nic_d("Sa\\dx~", Bhvadi), &["SAtayati", "SAdayati"]); + assert_has_tip( + &[], + &nic_d("Sa\\dx~", Bhvadi), + Lat, + &["SAtayati", "SAdayati"], + ); } #[test] fn sutra_7_3_43() { - assert_has_lat_p(&[], &nic_d("ru\\ha~", Bhvadi), &["ropayati", "rohayati"]); + assert_has_tip( + &[], + &nic_d("ru\\ha~", Bhvadi), + Lat, + &["ropayati", "rohayati"], + ); } #[test] @@ -218,7 +237,7 @@ fn sutra_7_3_54() { let han = d("ha\\na~", Adadi); assert_has_jhi(&[], &han, Lat, &["Gnanti"]); - assert_has_lat_p(&[], &nic(&han), &["GAtayati"]); + assert_has_tip(&[], &nic(&han), Lat, &["GAtayati"]); assert_has_krdanta(&[], &han, Krt::Rvul, &["GAtaka"]); assert_has_krdanta(&[], &han, Krt::Rini, &["GAtin"]); assert_has_krdanta(&[], &han, Krt::Ramul, &["GAtam"]); @@ -248,7 +267,7 @@ fn sutra_7_3_56() { assert_has_lat(&["pra"], &yan(&hi), &["prajeGIyate"]); assert_has_lit(&["pra"], &hi, &["prajiGAya"]); // acaNi - assert_has_lun_p(&["pra"], &nic(&hi), &["prAjIhayat"]); + assert_has_tip(&["pra"], &nic(&hi), Lun, &["prAjIhayat"]); } #[test] @@ -266,8 +285,8 @@ fn sutra_7_3_57() { #[test] fn sutra_7_3_58() { let ci = d("ci\\Y", Svadi); - assert_has_lat_p(&[], &san(&ci), &["cicIzati", "cikIzati"]); - assert_has_lit_p(&[], &ci, &["cikAya", "cicAya"]); + assert_has_tip(&[], &san(&ci), Lat, &["cicIzati", "cikIzati"]); + assert_has_tip(&[], &ci, Lit, &["cikAya", "cicAya"]); // sanlitoH assert_has_lat(&[], &yan(&ci), &["cecIyate"]); } @@ -383,18 +402,19 @@ fn sutra_7_3_73() { assert_has_thaas(&[], &duh, Lun, &["adugDAH", "aDukzaTAH"]); assert_has_dhvam(&[], &duh, Lun, &["aDugDvam", "aDukzaDvam"]); assert_has_vahi(&[], &duh, Lun, &["aduhvahi", "aDukzAvahi"]); - assert_has_lun_a(&[], &d("di\\ha~^", Adadi), &["adigDa", "aDikzata"]); - assert_has_lun_a(&[], &d("li\\ha~^", Adadi), &["alIQa", "alikzata"]); - assert_has_lun_a( + assert_has_ta(&[], &d("di\\ha~^", Adadi), Lun, &["adigDa", "aDikzata"]); + assert_has_ta(&[], &d("li\\ha~^", Adadi), Lun, &["alIQa", "alikzata"]); + assert_has_ta( &["ni"], &d("guhU~^", Bhvadi), + Lun, &["nyagUQa", "nyaGukzata", "nyagUhizwa"], ); // durAdInAm // TODO: how to derive this? - // assert_has_lun_a(&["vi", "ati"], &d("ru\\Sa~", Tudadi), &["vyatyarukzata"]); + // assert_has_ta(&["vi", "ati"], &d("ru\\Sa~", Tudadi), Lun, &["vyatyarukzata"]); // Atmanepade - assert_has_lun_p(&[], &duh, &["aDukzat"]); + assert_has_tip(&[], &duh, Lun, &["aDukzat"]); } #[test] @@ -415,12 +435,12 @@ fn sutra_7_3_74() { #[test] fn sutra_7_3_75() { - assert_has_lat_p(&[], &d("zWivu~", Bhvadi), &["zWIvati"]); - assert_has_lat_p(&[], &d("klamu~", Bhvadi), &["klAmati", "klAmyati"]); - assert_has_lat_p(&["AN"], &d("camu~", Bhvadi), &["AcAmati"]); + assert_has_tip(&[], &d("zWivu~", Bhvadi), Lat, &["zWIvati"]); + assert_has_tip(&[], &d("klamu~", Bhvadi), Lat, &["klAmati", "klAmyati"]); + assert_has_tip(&["AN"], &d("camu~", Bhvadi), Lat, &["AcAmati"]); // counterexamples - assert_has_lat_p(&[], &d("wuvama~", Bhvadi), &["vamati"]); - assert_has_lat_p(&["vi"], &d("camu~", Bhvadi), &["vicamati"]); + assert_has_tip(&[], &d("wuvama~", Bhvadi), Lat, &["vamati"]); + assert_has_tip(&["vi"], &d("camu~", Bhvadi), Lat, &["vicamati"]); } #[test] @@ -430,7 +450,7 @@ fn sutra_7_3_76() { assert_has_tas(&[], &kram, Lat, &["krAmataH", "krAmyataH"]); assert_has_jhi(&[], &kram, Lat, &["krAmanti", "krAmyanti"]); // parasmaipadezu - assert_has_lat_a(&["AN"], &kram, &["Akramate", "Akramyate"]); + assert_has_ta(&["AN"], &kram, Lat, &["Akramate", "Akramyate"]); // edge cases assert_has_sip( &["ud"], @@ -461,42 +481,42 @@ fn sutra_7_3_77() { #[test] fn sutra_7_3_78() { - assert_has_lat_p(&[], &d("pA\\", Bhvadi), &["pibati"]); - assert_has_lat_p(&[], &d("GrA\\", Bhvadi), &["jiGrati"]); - assert_has_lat_p(&[], &d("DmA\\", Bhvadi), &["Damati"]); - assert_has_lat_p(&[], &d("zWA\\", Bhvadi), &["tizWati"]); - assert_has_lat_p(&[], &d("mnA\\", Bhvadi), &["manati"]); - assert_has_lat_p(&[], &d("dA\\R", Bhvadi), &["yacCati"]); - assert_has_lat_p(&[], &d("df\\Si~r", Bhvadi), &["paSyati"]); - assert_has_lat_p(&[], &d("f\\", Bhvadi), &["fcCati"]); - assert_has_lat_p(&[], &d("sf\\", Bhvadi), &["DAvati", "sarati"]); - assert_has_lat_a(&[], &d("Sa\\dx~", Bhvadi), &["SIyate"]); - assert_has_lat_p(&[], &d("za\\dx~", Bhvadi), &["sIdati"]); + assert_has_tip(&[], &d("pA\\", Bhvadi), Lat, &["pibati"]); + assert_has_tip(&[], &d("GrA\\", Bhvadi), Lat, &["jiGrati"]); + assert_has_tip(&[], &d("DmA\\", Bhvadi), Lat, &["Damati"]); + assert_has_tip(&[], &d("zWA\\", Bhvadi), Lat, &["tizWati"]); + assert_has_tip(&[], &d("mnA\\", Bhvadi), Lat, &["manati"]); + assert_has_tip(&[], &d("dA\\R", Bhvadi), Lat, &["yacCati"]); + assert_has_tip(&[], &d("df\\Si~r", Bhvadi), Lat, &["paSyati"]); + assert_has_tip(&[], &d("f\\", Bhvadi), Lat, &["fcCati"]); + assert_has_tip(&[], &d("sf\\", Bhvadi), Lat, &["DAvati", "sarati"]); + assert_has_ta(&[], &d("Sa\\dx~", Bhvadi), Lat, &["SIyate"]); + assert_has_tip(&[], &d("za\\dx~", Bhvadi), Lat, &["sIdati"]); } #[test] fn sutra_7_3_79() { - assert_has_lat_p(&[], &d("jYA\\", Kryadi), &["jAnAti"]); - assert_has_lat_a(&[], &d("janI~\\", Divadi), &["jAyate"]); + assert_has_tip(&[], &d("jYA\\", Kryadi), Lat, &["jAnAti"]); + assert_has_ta(&[], &d("janI~\\", Divadi), Lat, &["jAyate"]); // daivAdikasya - assert_has_lat_p(&[], &d("jana~", Juhotyadi), &["jajanti"]); + assert_has_tip(&[], &d("jana~", Juhotyadi), Lat, &["jajanti"]); } #[test] fn sutra_7_3_80() { - assert_has_lat_p(&[], &d("pUY", Kryadi), &["punAti"]); - assert_has_lat_p(&[], &d("lUY", Kryadi), &["lunAti"]); - assert_has_lat_p(&[], &d("stFY", Kryadi), &["stfRAti"]); + assert_has_tip(&[], &d("pUY", Kryadi), Lat, &["punAti"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lat, &["lunAti"]); + assert_has_tip(&[], &d("stFY", Kryadi), Lat, &["stfRAti"]); // Regression test - assert_has_lat_p(&[], &d("jyA\\", Kryadi), &["jinAti"]); + assert_has_tip(&[], &d("jyA\\", Kryadi), Lat, &["jinAti"]); } #[test] fn sutra_7_3_82() { let mid = d("YimidA~", Divadi); assert_has_lat(&[], &mid, &["medyati"]); - assert_has_lat_karmani(&[], &mid, &["midyate"]); + assert_has_ta_k(&[], &mid, Lat, &["midyate"]); } #[test] @@ -511,9 +531,9 @@ fn sutra_7_3_83() { #[test] fn sutra_7_3_84() { - assert_has_lat_p(&[], &d("tF", Bhvadi), &["tarati"]); - assert_has_lat_p(&[], &d("RI\\Y", Bhvadi), &["nayati"]); - assert_has_lat_p(&[], &d("BU", Bhvadi), &["Bavati"]); + assert_has_tip(&[], &d("tF", Bhvadi), Lat, &["tarati"]); + assert_has_tip(&[], &d("RI\\Y", Bhvadi), Lat, &["nayati"]); + assert_has_tip(&[], &d("BU", Bhvadi), Lat, &["Bavati"]); assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Krt::tfc, &["kartf"]); assert_has_krdanta(&[], &d("ci\\Y", Svadi), Krt::tfc, &["cetf"]); @@ -528,14 +548,14 @@ fn sutra_7_3_84() { fn sutra_7_3_85() { let jagf = d("jAgf", Adadi); - assert_has_lat_p(&[], &nic(&jagf), &["jAgarayati"]); + assert_has_tip(&[], &nic(&jagf), Lat, &["jAgarayati"]); assert_has_krdanta(&[], &jagf, Krt::Rvul, &["jAgaraka"]); assert_has_krdanta(&[], &jagf, Krt::GaY, &["jAgara"]); assert_has_krdanta(&[], &jagf, Krt::kta, &["jAgarita"]); assert_has_krdanta(&[], &jagf, Krt::ktavatu, &["jAgaritavat"]); - assert_has_krdanta(&[], &jagf, Krt::kvinUnadi, &["jAgfvi"]); - assert_has_lun_karmani(&[], &jagf, &["ajAgAri"]); + assert_has_krdanta(&[], &jagf, Unadi::kvin, &["jAgfvi"]); + assert_has_ta_k(&[], &jagf, Lun, &["ajAgAri"]); assert_has_lit( &[], &jagf, @@ -546,9 +566,9 @@ fn sutra_7_3_85() { #[test] fn sutra_7_3_86() { - assert_has_lat_p(&[], &nic_d("vlI\\", Kryadi), &["vlepayati"]); - assert_has_lat_p(&[], &nic_d("hrI\\", Juhotyadi), &["hrepayati"]); - assert_has_lat_p(&[], &nic_d("knUyI~\\", Bhvadi), &["knopayati"]); + assert_has_tip(&[], &nic_d("vlI\\", Kryadi), Lat, &["vlepayati"]); + assert_has_tip(&[], &nic_d("hrI\\", Juhotyadi), Lat, &["hrepayati"]); + assert_has_tip(&[], &nic_d("knUyI~\\", Bhvadi), Lat, &["knopayati"]); let bhid = d("Bi\\di~^r", Rudhadi); let chid = d("Ci\\di~^r", Rudhadi); @@ -573,8 +593,8 @@ fn sutra_7_3_87() { assert_has_mip(&["pari"], &viz, Lan, &["paryavevizam"]); assert_has_mip(&[], &d("vida~", Adadi), Lot, &["vedAni", "vidANkaravARi"]); - assert_has_lat_p(&[], &nij, &["nenekti"]); - assert_has_lit_p(&[], &nij, &["nineja"]); + assert_has_tip(&[], &nij, Lat, &["nenekti"]); + assert_has_tip(&[], &nij, Lit, &["nineja"]); let hu = d("hu\\", Juhotyadi); assert_has_mip(&[], &hu, Lot, &["juhavAni"]); @@ -637,7 +657,7 @@ fn sutra_7_3_89() { assert_has_tas(&[], &ru, Lat, &["rutaH", "ruvItaH"]); // yAsuw - assert_has_vidhilin_p(&[], &stu, &["stuyAt", "stuvIyAt"]); + assert_has_tip(&[], &stu, VidhiLin, &["stuyAt", "stuvIyAt"]); // TODO: yoyogi, roroti } @@ -702,7 +722,7 @@ fn sutra_7_3_95() { assert_has_lat(&["upa"], &d("ru", Adadi), &["uparOti", "uparavIti"]); let stu = d("zwu\\Y", Adadi); - assert_has_lat_p(&["upa"], &stu, &["upastOti", "upastavIti"]); + assert_has_tip(&["upa"], &stu, Lat, &["upastOti", "upastavIti"]); assert_has_ta(&[], &stu, VidhiLin, &["stuvIta"]); // Sam and am are chAndasa. @@ -715,10 +735,10 @@ fn sutra_7_3_96() { assert_has_sip(&[], &asa, Lan, &["AsIH"]); let kf = d("qukf\\Y", Tanadi); - assert_has_lun_p(&[], &kf, &["akArzIt"]); - assert_has_lun_p(&[], &d("zu\\Y", Svadi), &["asAvIt"]); - assert_has_lun_p(&[], &d("lUY", Kryadi), &["alAvIt"]); - assert_has_lun_p(&[], &d("pUY", Kryadi), &["apAvIt"]); + assert_has_tip(&[], &kf, Lun, &["akArzIt"]); + assert_has_tip(&[], &d("zu\\Y", Svadi), Lun, &["asAvIt"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lun, &["alAvIt"]); + assert_has_tip(&[], &d("pUY", Kryadi), Lun, &["apAvIt"]); assert_has_lat(&[], &asa, &["asti"]); assert_has_mip(&[], &kf, Lun, &["akArzam"]); diff --git a/vidyut-prakriya/tests/kashika_7_4.rs b/vidyut-prakriya/tests/kashika_7_4.rs index aee9d05..3ccd6ec 100644 --- a/vidyut-prakriya/tests/kashika_7_4.rs +++ b/vidyut-prakriya/tests/kashika_7_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -18,35 +19,61 @@ fn nic_san(dhatu: &Dhatu) -> Dhatu { #[test] fn sutra_7_4_1() { - assert_has_lun_p(&[], &nic(&d("qukf\\Y", Tanadi)), &["acIkarat"]); - assert_has_lun_p(&[], &nic(&d("hf\\Y", Bhvadi)), &["ajIharat"]); - assert_has_lun_p(&[], &nic(&d("lUY", Kryadi)), &["alIlavat"]); - assert_has_lun_p(&[], &nic(&d("pUY", Kryadi)), &["apIpavat"]); + assert_has_tip(&[], &nic(&d("qukf\\Y", Tanadi)), Lun, &["acIkarat"]); + assert_has_tip(&[], &nic(&d("hf\\Y", Bhvadi)), Lun, &["ajIharat"]); + assert_has_tip(&[], &nic(&d("lUY", Kryadi)), Lun, &["alIlavat"]); + assert_has_tip(&[], &nic(&d("pUY", Kryadi)), Lun, &["apIpavat"]); // TODO: many more. } #[test] fn sutra_7_4_2() { - assert_has_lun_p(&[], &nic(&d("SAsu~", Bhvadi)), &["aSaSAsat"]); - assert_has_lun_p(&[], &nic(&d("bADf~\\", Bhvadi)), &["ababADat"]); - assert_has_lun_p(&[], &nic(&d("quyAcf~^", Bhvadi)), &["ayayAcat"]); - assert_has_lun_p(&[], &nic(&d("QOkf~\\", Bhvadi)), &["aquQOkat"]); + assert_has_tip(&[], &nic(&d("SAsu~", Bhvadi)), Lun, &["aSaSAsat"]); + assert_has_tip(&[], &nic(&d("bADf~\\", Bhvadi)), Lun, &["ababADat"]); + assert_has_tip(&[], &nic(&d("quyAcf~^", Bhvadi)), Lun, &["ayayAcat"]); + assert_has_tip(&[], &nic(&d("QOkf~\\", Bhvadi)), Lun, &["aquQOkat"]); } #[test] fn sutra_7_4_3() { - assert_has_lun_p( + assert_has_tip( &[], &nic(&d("wuBrAjf~\\", Bhvadi)), + Lun, &["abiBrajat", "abaBrAjat"], ); - assert_has_lun_p(&[], &nic(&d("BAsf~\\", Bhvadi)), &["abIBasat", "abaBAsat"]); - assert_has_lun_p(&[], &nic(&d("BAza~\\", Bhvadi)), &["abIBazat", "abaBAzat"]); - assert_has_lun_p(&[], &nic(&d("dIpI~\\", Divadi)), &["adIdipat", "adidIpat"]); - assert_has_lun_p(&[], &nic(&d("jIva~", Bhvadi)), &["ajIjivat", "ajijIvat"]); - assert_has_lun_p(&[], &nic(&d("mIla~", Bhvadi)), &["amImilat", "amimIlat"]); - assert_has_lun_p(&[], &d("pIqa~", Curadi), &["apIpiqat", "apipIqat"]); + assert_has_tip( + &[], + &nic(&d("BAsf~\\", Bhvadi)), + Lun, + &["abIBasat", "abaBAsat"], + ); + assert_has_tip( + &[], + &nic(&d("BAza~\\", Bhvadi)), + Lun, + &["abIBazat", "abaBAzat"], + ); + assert_has_tip( + &[], + &nic(&d("dIpI~\\", Divadi)), + Lun, + &["adIdipat", "adidIpat"], + ); + assert_has_tip( + &[], + &nic(&d("jIva~", Bhvadi)), + Lun, + &["ajIjivat", "ajijIvat"], + ); + assert_has_tip( + &[], + &nic(&d("mIla~", Bhvadi)), + Lun, + &["amImilat", "amimIlat"], + ); + assert_has_tip(&[], &d("pIqa~", Curadi), Lun, &["apIpiqat", "apipIqat"]); } #[ignore] @@ -76,9 +103,14 @@ fn sutra_7_4_6() { #[test] fn sutra_7_4_7() { - assert_has_lun_p(&[], &d("kFta~", Curadi), &["acikIrtat", "acIkftat"]); - assert_has_lun_p(&[], &nic(&d("vftu~\\", Bhvadi)), &["avavartat", "avIvftat"]); - assert_has_lun_p(&[], &d("mfjU~", Curadi), &["amamArjat", "amImfjat"]); + assert_has_tip(&[], &d("kFta~", Curadi), Lun, &["acikIrtat", "acIkftat"]); + assert_has_tip( + &[], + &nic(&d("vftu~\\", Bhvadi)), + Lun, + &["avavartat", "avIvftat"], + ); + assert_has_tip(&[], &d("mfjU~", Curadi), Lun, &["amamArjat", "amImfjat"]); } #[test] @@ -115,8 +147,8 @@ fn sutra_7_4_10() { assert_has_tas(&[], &kf, Lit, &["cakratuH"]); assert_has_jhi(&[], &kf, Lit, &["cakruH"]); // vrddhi otherwise - assert_has_lit_p(&[], &svf, &["sasvAra"]); - assert_has_lit_p(&[], &smf, &["sasmAra"]); + assert_has_tip(&[], &svf, Lit, &["sasvAra"]); + assert_has_tip(&[], &smf, Lit, &["sasmAra"]); // liwi assert_has_krdanta(&[], &smf, Krt::kta, &["smfta"]); assert_has_krdanta(&[], &smf, Krt::ktavatu, &["smftavat"]); @@ -223,7 +255,7 @@ fn sutra_7_4_21() { #[test] fn sutra_7_4_22() { let shi = d("SIN", Adadi); - assert_has_lat_karmani(&[], &shi, &["Sayyate"]); + assert_has_ta_k(&[], &shi, Lat, &["Sayyate"]); assert_has_lat(&[], &yan(&shi), &["SASayyate"]); assert_has_krdanta(&["pra"], &shi, Krt::ktvA, &["praSayya"]); assert_has_krdanta(&["upa"], &shi, Krt::ktvA, &["upaSayya"]); @@ -234,19 +266,19 @@ fn sutra_7_4_22() { #[test] fn sutra_7_4_23() { let uh = d("Uha~\\", Bhvadi); - assert_has_lat_karmani(&["sam"], &uh, &["samuhyate"]); + assert_has_ta_k(&["sam"], &uh, Lat, &["samuhyate"]); assert_has_krdanta(&["sam"], &uh, Krt::ktvA, &["samuhya"]); - assert_has_lat_karmani(&["aBi"], &uh, &["aByuhyate"]); + assert_has_ta_k(&["aBi"], &uh, Lat, &["aByuhyate"]); assert_has_krdanta(&["aBi"], &uh, Krt::ktvA, &["aByuhya"]); - assert_has_lat_karmani(&[], &uh, &["Uhyate"]); + assert_has_ta_k(&[], &uh, Lat, &["Uhyate"]); let ih = d("Iha~\\", Bhvadi); - assert_has_lat_karmani(&["sam"], &ih, &["samIhyate"]); + assert_has_ta_k(&["sam"], &ih, Lat, &["samIhyate"]); assert_has_krdanta(&["sam"], &uh, Krt::kta, &["samUhita"]); - assert_has_lat_karmani(&["AN"], &uh, &["ohyate"]); - assert_has_lat_karmani(&["sam", "AN"], &uh, &["samohyate"]); + assert_has_ta_k(&["AN"], &uh, Lat, &["ohyate"]); + assert_has_ta_k(&["sam", "AN"], &uh, Lat, &["samohyate"]); } #[test] @@ -266,22 +298,22 @@ fn sutra_7_4_24() { fn sutra_7_4_25() { // TODO: others let ci = d("ci\\Y", Svadi); - assert_has_lat_karmani(&[], &ci, &["cIyate"]); + assert_has_ta_k(&[], &ci, Lat, &["cIyate"]); assert_has_lat(&[], &yan(&ci), &["cecIyate"]); let stu = d("zwu\\Y", Adadi); - assert_has_lat_karmani(&[], &stu, &["stUyate"]); + assert_has_ta_k(&[], &stu, Lat, &["stUyate"]); assert_has_lat(&[], &yan(&stu), &["tozwUyate"]); - assert_has_ashirlin_p(&[], &ci, &["cIyAt"]); - assert_has_ashirlin_p(&[], &stu, &["stUyAt"]); + assert_has_tip(&[], &ci, AshirLin, &["cIyAt"]); + assert_has_tip(&[], &stu, AshirLin, &["stUyAt"]); // a-krti? assert_has_krdanta(&["pra"], &d("qukf\\Y", Tanadi), Krt::ktvA, &["prakftya"]); assert_has_krdanta(&["pra"], &d("hf\\Y", Bhvadi), Krt::ktvA, &["prahftya"]); // a-sArvadhAtuke? - assert_has_vidhilin_p(&[], &ci, &["cinuyAt"]); - assert_has_vidhilin_p(&[], &d("zu\\Y", Svadi), &["sunuyAt"]); + assert_has_tip(&[], &ci, VidhiLin, &["cinuyAt"]); + assert_has_tip(&[], &d("zu\\Y", Svadi), VidhiLin, &["sunuyAt"]); } #[test] @@ -313,30 +345,30 @@ fn sutra_7_4_28() { let hf = d("hf\\Y", Bhvadi); let bhf = d("quBf\\Y", Juhotyadi); - assert_has_lat_karmani(&["AN"], &d("df\\N", Tudadi), &["Adriyate"]); - assert_has_lat_karmani(&["AN"], &d("Df\\Y", Bhvadi), &["ADriyate"]); - assert_has_lat_karmani(&[], &kf, &["kriyate"]); - assert_has_lat_karmani(&[], &hf, &["hriyate"]); - assert_has_ashirlin_p(&[], &kf, &["kriyAt"]); - assert_has_ashirlin_p(&[], &hf, &["hriyAt"]); - assert_has_vidhilin_p(&[], &bhf, &["biBfyAt"]); - assert_has_ashirlin_a(&[], &kf, &["kfzIzwa"]); - assert_has_ashirlin_a(&[], &hf, &["hfzIzwa"]); + assert_has_ta_k(&["AN"], &d("df\\N", Tudadi), Lat, &["Adriyate"]); + assert_has_ta_k(&["AN"], &d("Df\\Y", Bhvadi), Lat, &["ADriyate"]); + assert_has_ta_k(&[], &kf, Lat, &["kriyate"]); + assert_has_ta_k(&[], &hf, Lat, &["hriyate"]); + assert_has_tip(&[], &kf, AshirLin, &["kriyAt"]); + assert_has_tip(&[], &hf, AshirLin, &["hriyAt"]); + assert_has_tip(&[], &bhf, VidhiLin, &["biBfyAt"]); + assert_has_ta(&[], &kf, AshirLin, &["kfzIzwa"]); + assert_has_ta(&[], &hf, AshirLin, &["hfzIzwa"]); } #[test] fn sutra_7_4_29() { let f = d("f\\", Bhvadi); - assert_has_lat_karmani(&[], &f, &["aryate"]); - assert_has_ashirlin_p(&[], &f, &["aryAt"]); + assert_has_ta_k(&[], &f, Lat, &["aryate"]); + assert_has_tip(&[], &f, AshirLin, &["aryAt"]); let smf = d("smf", Bhvadi); - assert_has_lat_karmani(&[], &smf, &["smaryate"]); - assert_has_ashirlin_p(&[], &smf, &["smaryAt"]); + assert_has_ta_k(&[], &smf, Lat, &["smaryate"]); + assert_has_tip(&[], &smf, AshirLin, &["smaryAt"]); let kf = d("qukf\\Y", Tanadi); - assert_has_lat_karmani(&["sam"], &kf, &["saMskriyate", "saNkriyate"]); - assert_has_ashirlin_p(&["sam"], &kf, &["saMskriyAt", "saNkriyAt"]); + assert_has_ta_k(&["sam"], &kf, Lat, &["saMskriyate", "saNkriyate"]); + assert_has_tip(&["sam"], &kf, AshirLin, &["saMskriyAt", "saNkriyAt"]); // TODO: also derives svarizIzwa and svArizIzwa, which I need to check. /* @@ -490,8 +522,8 @@ fn sutra_7_4_53() { assert_has_krdanta(&["AN"], &didhi, Krt::ktvA, &["AdIDya"]); assert_has_krdanta(&["AN"], &vevi, Krt::ktvA, &["Avevya"]); - assert_has_lat_karmani(&["AN"], &didhi, &["AdIDyate"]); - assert_has_lat_karmani(&["AN"], &vevi, &["Avevyate"]); + assert_has_ta_k(&["AN"], &didhi, Lat, &["AdIDyate"]); + assert_has_ta_k(&["AN"], &vevi, Lat, &["Avevyate"]); assert_has_krdanta(&["AN"], &didhi, Krt::tfc, &["AdIDitf"]); assert_has_krdanta(&["AN"], &vevi, Krt::tfc, &["Avevitf"]); assert_has_vidhilin(&["AN"], &didhi, &["AdIDIta"]); @@ -503,20 +535,20 @@ fn sutra_7_4_53() { #[test] fn sutra_7_4_54() { - assert_has_lat_p(&[], &san(&d("mI\\Y", Kryadi)), &["mitsati"]); - assert_has_lat_p(&["pra"], &san(&d("qumi\\Y", Svadi)), &["pramitsati"]); + assert_has_tip(&[], &san(&d("mI\\Y", Kryadi)), Lat, &["mitsati"]); + assert_has_tip(&["pra"], &san(&d("qumi\\Y", Svadi)), Lat, &["pramitsati"]); assert_has_lat(&[], &san(&d("mA\\", Adadi)), &["mitsati"]); assert_has_lat(&[], &san(&d("mA\\N", Juhotyadi)), &["mitsate"]); assert_has_lat(&["apa"], &san(&d("me\\N", Bhvadi)), &["apamitsate"]); - assert_has_lat_p(&[], &san(&d("qudA\\Y", Juhotyadi)), &["ditsati"]); - assert_has_lat_p(&[], &san(&d("quDA\\Y", Juhotyadi)), &["Ditsati"]); + assert_has_tip(&[], &san(&d("qudA\\Y", Juhotyadi)), Lat, &["ditsati"]); + assert_has_tip(&[], &san(&d("quDA\\Y", Juhotyadi)), Lat, &["Ditsati"]); assert_has_lat(&["AN"], &san(&d("ra\\Ba~\\", Bhvadi)), &["Aripsate"]); assert_has_lat(&["AN"], &san(&d("qula\\Ba~\\z", Bhvadi)), &["Alipsate"]); assert_has_lat(&[], &san(&d("Sa\\kx~", Svadi)), &["Sikzati"]); assert_has_lat(&[], &san(&d("patx~", Bhvadi)), &["pitsati", "pipatizati"]); assert_has_lat(&["pra"], &san(&d("pa\\da~\\", Divadi)), &["prapitsate"]); // sani - assert_has_lrt_p(&[], &d("qudA\\Y", Juhotyadi), &["dAsyati"]); + assert_has_tip(&[], &d("qudA\\Y", Juhotyadi), Lrt, &["dAsyati"]); // si -- see `pipatizati` above. } @@ -530,7 +562,7 @@ fn sutra_7_4_55() { assert_has_lat(&[], &san(&jnap), &["jYIpsati", "jijYapayizati"]); assert_has_lat(&[], &san(&rdh), &["Irtsati", "ardiDizati"]); // sani - assert_has_lrt_p(&["pra"], &san(&aap), &["prApsyati"]); + assert_has_tip(&["pra"], &san(&aap), Lrt, &["prApsyati"]); // si -- see examples above. } @@ -541,8 +573,8 @@ fn sutra_7_4_58() { assert_has_lat(&[], &san(&qauk), &["quQOkizate"]); assert_has_lat(&[], &san(&trauk), &["tutrOkizate"]); // caNi - assert_has_lun_p(&[], &nic(&d("mI\\Y", Kryadi)), &["amImapat"]); - assert_has_lun_p(&[], &nic(&d("qudA\\Y", Juhotyadi)), &["adIdapat"]); + assert_has_tip(&[], &nic(&d("mI\\Y", Kryadi)), Lun, &["amImapat"]); + assert_has_tip(&[], &nic(&d("qudA\\Y", Juhotyadi)), Lun, &["adIdapat"]); } #[test] @@ -553,17 +585,17 @@ fn sutra_7_4_59() { assert_has_lat(&[], &san(&trauk), &["tutrOkizate"]); assert_has_lit(&[], &qauk, &["quQOke"]); assert_has_lit(&[], &trauk, &["tutrOke"]); - assert_has_lun_p(&[], &nic(&qauk), &["aquQOkat"]); - assert_has_lun_p(&[], &nic(&trauk), &["atutrOkat"]); + assert_has_tip(&[], &nic(&qauk), Lun, &["aquQOkat"]); + assert_has_tip(&[], &nic(&trauk), Lun, &["atutrOkat"]); // TODO: others. } #[test] fn sutra_7_4_60() { - assert_has_lit_p(&[], &d("glE\\", Bhvadi), &["jaglO"]); - assert_has_lit_p(&[], &d("mlE\\", Bhvadi), &["mamlO"]); - assert_has_lit_p(&[], &d("qupa\\ca~^z", Bhvadi), &["papAca"]); - assert_has_lit_p(&[], &d("paWa~", Bhvadi), &["papAWa"]); + assert_has_tip(&[], &d("glE\\", Bhvadi), Lit, &["jaglO"]); + assert_has_tip(&[], &d("mlE\\", Bhvadi), Lit, &["mamlO"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lit, &["papAca"]); + assert_has_tip(&[], &d("paWa~", Bhvadi), Lit, &["papAWa"]); let aw = d("awa~", Bhvadi); assert_has_tip(&[], &aw, Lit, &["Awa"]); @@ -578,23 +610,23 @@ fn sutra_7_4_61() { &san(&d("Scyuti~r", Bhvadi)), &["cuScyotizati", "cuScyutizati"], ); - assert_has_lat_p(&[], &san(&d("zWA\\", Bhvadi)), &["tizWAsati"]); + assert_has_tip(&[], &san(&d("zWA\\", Bhvadi)), Lat, &["tizWAsati"]); assert_has_lat(&[], &san(&d("spadi~\\", Bhvadi)), &["pispandizate"]); // SarpUrva - assert_has_lit_p(&[], &d("qupa\\ca~^z", Bhvadi), &["papAca"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lit, &["papAca"]); // KayaH assert_has_lit(&[], &d("zRE\\", Bhvadi), &["sasnO"]); } #[test] fn sutra_7_4_62() { - assert_has_lit_p(&[], &d("qukf\\Y", Tanadi), &["cakAra"]); - assert_has_lit_p(&[], &d("Kanu~^", Bhvadi), &["caKAna"]); - assert_has_lit_p(&[], &d("ga\\mx~", Bhvadi), &["jagAma"]); - assert_has_lit_p(&[], &d("ha\\na~", Adadi), &["jaGAna"]); - assert_has_lit_p(&[], &d("hf\\Y", Bhvadi), &["jahAra"]); - assert_has_lat_p(&[], &san(&d("hf\\Y", Bhvadi)), &["jihIrzati"]); - assert_has_lit_p(&[], &d("o~hA\\k", Juhotyadi), &["jahO"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lit, &["cakAra"]); + assert_has_tip(&[], &d("Kanu~^", Bhvadi), Lit, &["caKAna"]); + assert_has_tip(&[], &d("ga\\mx~", Bhvadi), Lit, &["jagAma"]); + assert_has_tip(&[], &d("ha\\na~", Adadi), Lit, &["jaGAna"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lit, &["jahAra"]); + assert_has_tip(&[], &san(&d("hf\\Y", Bhvadi)), Lat, &["jihIrzati"]); + assert_has_tip(&[], &d("o~hA\\k", Juhotyadi), Lit, &["jahO"]); } #[test] @@ -619,13 +651,13 @@ fn sutra_7_4_66() { fn sutra_7_4_67() { let dyut = d("dyuta~\\", Bhvadi); assert_has_lit(&["vi"], &dyut, &["vididyute"]); - assert_has_lun_p(&["vi"], &nic(&dyut), &["vyadidyutat"]); + assert_has_tip(&["vi"], &nic(&dyut), Lun, &["vyadidyutat"]); assert_has_lat(&["vi"], &san(&dyut), &["vididyotizate", "vididyutizate"]); assert_has_lat(&["vi"], &yan(&dyut), &["videdyutyate"]); // TODO let _svap = d("Yizva\\pa~", Adadi).with_sanadi(&[Sanadi::Nic, Sanadi::San]); - // assert_has_lat_p(&[], &svap, &["suzvApayizati"]); + // assert_has_tip(&[], &svap, Lat, &["suzvApayizati"]); } #[test] @@ -655,8 +687,8 @@ fn sutra_7_4_70() { assert_has_tas(&[], &aw, Lit, &["AwatuH"]); assert_has_jhi(&[], &aw, Lit, &["AwuH"]); // AdeH - assert_has_lit_p(&[], &d("qupa\\ca~^z", Bhvadi), &["papAca"]); - assert_has_lit_p(&[], &d("paWa~", Bhvadi), &["papAWa"]); + assert_has_tip(&[], &d("qupa\\ca~^z", Bhvadi), Lit, &["papAca"]); + assert_has_tip(&[], &d("paWa~", Bhvadi), Lit, &["papAWa"]); } #[test] @@ -703,49 +735,50 @@ fn sutra_7_4_73() { #[test] fn sutra_7_4_75() { let nij = d("Ri\\ji~^r", Juhotyadi); - assert_has_lat_p(&[], &nij, &["nenekti"]); - assert_has_lat_p(&[], &d("vi\\ji~^r", Juhotyadi), &["vevekti"]); - assert_has_lat_p(&[], &d("vi\\zx~^", Juhotyadi), &["vevezwi"]); + assert_has_tip(&[], &nij, Lat, &["nenekti"]); + assert_has_tip(&[], &d("vi\\ji~^r", Juhotyadi), Lat, &["vevekti"]); + assert_has_tip(&[], &d("vi\\zx~^", Juhotyadi), Lat, &["vevezwi"]); // SlO - assert_has_lit_p(&[], &nij, &["nineja"]); + assert_has_tip(&[], &nij, Lit, &["nineja"]); } #[test] fn sutra_7_4_76() { let bhf = d("quBf\\Y", Juhotyadi); - assert_has_lat_p(&[], &bhf, &["biBarti"]); - assert_has_lat_a(&[], &d("mA\\N", Juhotyadi), &["mimIte"]); - assert_has_lat_a(&[], &d("o~hA\\N", Juhotyadi), &["jihIte"]); + assert_has_tip(&[], &bhf, Lat, &["biBarti"]); + assert_has_ta(&[], &d("mA\\N", Juhotyadi), Lat, &["mimIte"]); + assert_has_ta(&[], &d("o~hA\\N", Juhotyadi), Lat, &["jihIte"]); // trayARAm - assert_has_lat_p(&[], &d("o~hA\\k", Juhotyadi), &["jahAti"]); + assert_has_tip(&[], &d("o~hA\\k", Juhotyadi), Lat, &["jahAti"]); // SlO - assert_has_lit_p( + assert_has_tip( &[], &bhf, + Lit, &["baBAra", "biBarAYcakAra", "biBarAmAsa", "biBarAmbaBUva"], ); } #[test] fn sutra_7_4_77() { - assert_has_lat_p(&[], &d("f\\", Juhotyadi), &["iyarti"]); - assert_has_lat_p(&[], &d("pF", Juhotyadi), &["piparti"]); + assert_has_tip(&[], &d("f\\", Juhotyadi), Lat, &["iyarti"]); + assert_has_tip(&[], &d("pF", Juhotyadi), Lat, &["piparti"]); } #[test] fn sutra_7_4_79() { let pac = d("qupa\\ca~^z", Bhvadi); - assert_has_lat_p(&[], &san(&pac), &["pipakzati"]); - assert_has_lat_p(&[], &san(&d("ya\\ja~^", Bhvadi)), &["yiyakzati"]); - assert_has_lat_p(&[], &san(&d("zWA\\", Bhvadi)), &["tizWAsati"]); - assert_has_lat_p(&[], &san(&d("pA\\", Bhvadi)), &["pipAsati"]); + assert_has_tip(&[], &san(&pac), Lat, &["pipakzati"]); + assert_has_tip(&[], &san(&d("ya\\ja~^", Bhvadi)), Lat, &["yiyakzati"]); + assert_has_tip(&[], &san(&d("zWA\\", Bhvadi)), Lat, &["tizWAsati"]); + assert_has_tip(&[], &san(&d("pA\\", Bhvadi)), Lat, &["pipAsati"]); // sani - assert_has_lit_p(&[], &pac, &["papAca"]); + assert_has_tip(&[], &pac, Lit, &["papAca"]); // ataH - assert_has_lat_p(&[], &san(&d("lUY", Kryadi)), &["lulUzati"]); + assert_has_tip(&[], &san(&d("lUY", Kryadi)), Lat, &["lulUzati"]); // taparakaraNa let _pac_yan_san = pac.with_sanadi(&[Sanadi::Yan, Sanadi::San]); - // assert_has_lat_a(&[], &pac_yan_san, &["pApacizate"]); + // assert_has_ta(&[], &pac_yan_san, Lat, &["pApacizate"]); // TODO: pApacizate } @@ -755,26 +788,26 @@ fn sutra_7_4_80() { let pu = d("pUN", Bhvadi); let bhu = d("BU", Bhvadi); assert_has_lat(&[], &san(&pu), &["pipavizate"]); - assert_has_lat_p(&[], &nic_san(&pu), &["pipAvayizati"]); - assert_has_lat_p(&[], &nic_san(&bhu), &["biBAvayizati"]); + assert_has_tip(&[], &nic_san(&pu), Lat, &["pipAvayizati"]); + assert_has_tip(&[], &nic_san(&bhu), Lat, &["biBAvayizati"]); let yu = d("yu", Adadi); let ru = d("ru", Adadi); let lu = d("lUY", Kryadi); assert_has_lat(&[], &san(&yu), &["yiyavizati", "yuyUzati"]); - assert_has_lat_p(&[], &nic_san(&yu), &["yiyAvayizati"]); - assert_has_lat_p(&[], &nic_san(&ru), &["rirAvayizati"]); - assert_has_lat_p(&[], &nic_san(&lu), &["lilAvayizati"]); + assert_has_tip(&[], &nic_san(&yu), Lat, &["yiyAvayizati"]); + assert_has_tip(&[], &nic_san(&ru), Lat, &["rirAvayizati"]); + assert_has_tip(&[], &nic_san(&lu), Lat, &["lilAvayizati"]); // ju (sautro dhatu) let ju = d("ju", Adadi); - assert_has_lat_p(&[], &nic_san(&ju), &["jijAvayizati"]); + assert_has_tip(&[], &nic_san(&ju), Lat, &["jijAvayizati"]); // oH let pac = d("qupa\\ca~^z", Bhvadi); - assert_has_lat_a(&[], &yan(&pac), &["pApacyate"]); - assert_has_lat_a(&[], &yan_san(&pac), &["pApacizate"]); + assert_has_ta(&[], &yan(&pac), Lat, &["pApacyate"]); + assert_has_ta(&[], &yan_san(&pac), Lat, &["pApacizate"]); // puyaNjyapare let tu = d("tu\\", Adadi); - assert_has_lat_p(&["ava"], &nic_san(&tu), &["avatutAvayizati"]); - assert_has_lat_p(&[], &nic_san(&d("hu\\", Juhotyadi)), &["juhAvayizati"]); + assert_has_tip(&["ava"], &nic_san(&tu), Lat, &["avatutAvayizati"]); + assert_has_tip(&[], &nic_san(&d("hu\\", Juhotyadi)), Lat, &["juhAvayizati"]); assert_has_lat(&[], &san(&bhu), &["buBUzati"]); } @@ -782,31 +815,45 @@ fn sutra_7_4_80() { fn sutra_7_4_81() { let sru = &d("sru\\", Bhvadi); let shru = &d("Sru\\", Bhvadi); - assert_has_lat_p(&[], &nic_san(&sru), &["sisrAvayizati", "susrAvayizati"]); - assert_has_lat_p(&[], &nic_san(&shru), &["SiSrAvayizati", "SuSrAvayizati"]); - assert_has_lat_p( + assert_has_tip( + &[], + &nic_san(&sru), + Lat, + &["sisrAvayizati", "susrAvayizati"], + ); + assert_has_tip( + &[], + &nic_san(&shru), + Lat, + &["SiSrAvayizati", "SuSrAvayizati"], + ); + assert_has_tip( &[], &nic_san(&d("dru\\", Bhvadi)), + Lat, &["didrAvayizati", "dudrAvayizati"], ); - assert_has_lat_p( + assert_has_tip( &[], &nic_san(&d("pru\\N", Bhvadi)), + Lat, &["piprAvayizati", "puprAvayizati"], ); - assert_has_lat_p( + assert_has_tip( &[], &nic_san(&d("plu\\N", Bhvadi)), + Lat, &["piplAvayizati", "puplAvayizati"], ); - assert_has_lat_p( + assert_has_tip( &[], &nic_san(&d("cyu\\N", Bhvadi)), + Lat, &["cicyAvayizati", "cucyAvayizati"], ); // apare? - assert_has_lat_p(&[], &san(&sru), &["susrUzati"]); - assert_has_lat_a(&[], &san(&shru), &["SuSrUzate"]); + assert_has_tip(&[], &san(&sru), Lat, &["susrUzati"]); + assert_has_ta(&[], &san(&shru), Lat, &["SuSrUzate"]); } #[test] @@ -828,10 +875,10 @@ fn sutra_7_4_82() { #[test] fn sutra_7_4_83() { let pac = d("qupa\\ca~^z", Bhvadi); - assert_has_lat_a(&[], &yan(&pac), &["pApacyate"]); + assert_has_ta(&[], &yan(&pac), Lat, &["pApacyate"]); assert_has_lat(&[], &yan_luk(&pac), &["pApacIti", "pApakti"]); let yaj = d("ya\\ja~^", Bhvadi); - assert_has_lat_a(&[], &yan(&yaj), &["yAyajyate"]); + assert_has_ta(&[], &yan(&yaj), Lat, &["yAyajyate"]); assert_has_lat(&[], &yan_luk(&yaj), &["yAyajIti", "yAyazwi"]); } @@ -1078,77 +1125,108 @@ fn sutra_7_4_93() { let pac = &d("qupa\\ca~^z", Bhvadi); // sanyataH - assert_has_lun_p(&[], &nic(&d("qukf\\Y", Tanadi)), &["acIkarat"]); - assert_has_lun_p(&[], &nic(&pac), &["apIpacat"]); + assert_has_tip(&[], &nic(&d("qukf\\Y", Tanadi)), Lun, &["acIkarat"]); + assert_has_tip(&[], &nic(&pac), Lun, &["apIpacat"]); // oH puyaRjyapare - assert_has_lun_p(&[], &nic(&d("pUY", Kryadi)), &["apIpavat"]); - assert_has_lun_p(&[], &nic(&d("lUY", Kryadi)), &["alIlavat"]); + assert_has_tip(&[], &nic(&d("pUY", Kryadi)), Lun, &["apIpavat"]); + assert_has_tip(&[], &nic(&d("lUY", Kryadi)), Lun, &["alIlavat"]); // svarati... (7.4.81) - assert_has_lun_p(&[], &nic(&d("sru\\", Bhvadi)), &["asisravat", "asusravat"]); - assert_has_lun_p(&[], &nic(&d("Sru\\", Svadi)), &["aSiSravat", "aSuSravat"]); - assert_has_lun_p(&[], &nic(&d("dru\\", Bhvadi)), &["adidravat", "adudravat"]); - assert_has_lun_p(&[], &nic(&d("pru\\N", Bhvadi)), &["apipravat", "apupravat"]); - assert_has_lun_p(&[], &nic(&d("plu\\N", Bhvadi)), &["apiplavat", "apuplavat"]); - assert_has_lun_p(&[], &nic(&d("cyu\\N", Bhvadi)), &["acicyavat", "acucyavat"]); + assert_has_tip( + &[], + &nic(&d("sru\\", Bhvadi)), + Lun, + &["asisravat", "asusravat"], + ); + assert_has_tip( + &[], + &nic(&d("Sru\\", Svadi)), + Lun, + &["aSiSravat", "aSuSravat"], + ); + assert_has_tip( + &[], + &nic(&d("dru\\", Bhvadi)), + Lun, + &["adidravat", "adudravat"], + ); + assert_has_tip( + &[], + &nic(&d("pru\\N", Bhvadi)), + Lun, + &["apipravat", "apupravat"], + ); + assert_has_tip( + &[], + &nic(&d("plu\\N", Bhvadi)), + Lun, + &["apiplavat", "apuplavat"], + ); + assert_has_tip( + &[], + &nic(&d("cyu\\N", Bhvadi)), + Lun, + &["acicyavat", "acucyavat"], + ); // laghuni - assert_has_lun_p(&[], &nic(&d("takzU~", Bhvadi)), &["atatakzat"]); - assert_has_lun_p(&[], &nic(&d("rakza~", Bhvadi)), &["ararakzat"]); - assert_has_lun_p(&[], &nic(&d("jAgf", Adadi)), &["ajajAgarat"]); + assert_has_tip(&[], &nic(&d("takzU~", Bhvadi)), Lun, &["atatakzat"]); + assert_has_tip(&[], &nic(&d("rakza~", Bhvadi)), Lun, &["ararakzat"]); + assert_has_tip(&[], &nic(&d("jAgf", Adadi)), Lun, &["ajajAgarat"]); // caN-pare? assert_has_mip(&[], &pac, Lit, &["papaca", "papAca"]); // para-grahaRa - assert_has_lun_a(&[], &d("kamu~\\", Bhvadi), &["acakamata", "acIkamata"]); + assert_has_ta(&[], &d("kamu~\\", Bhvadi), Lun, &["acakamata", "acIkamata"]); // an-ak-lopa - assert_has_lun_p(&[], &d("kaTa", Curadi), &["acakaTat"]); + assert_has_tip(&[], &d("kaTa", Curadi), Lun, &["acakaTat"]); // TODO: others } #[test] fn sutra_7_4_94() { let pac = &d("qupa\\ca~^z", Bhvadi); - assert_has_lun_p(&[], &nic(&d("qukf\\Y", Tanadi)), &["acIkarat"]); - assert_has_lun_p(&[], &nic(&d("hf\\Y", Bhvadi)), &["ajIharat"]); - assert_has_lun_p(&[], &nic(&d("lUY", Kryadi)), &["alIlavat"]); - assert_has_lun_p(&[], &nic(&pac), &["apIpacat"]); + assert_has_tip(&[], &nic(&d("qukf\\Y", Tanadi)), Lun, &["acIkarat"]); + assert_has_tip(&[], &nic(&d("hf\\Y", Bhvadi)), Lun, &["ajIharat"]); + assert_has_tip(&[], &nic(&d("lUY", Kryadi)), Lun, &["alIlavat"]); + assert_has_tip(&[], &nic(&pac), Lun, &["apIpacat"]); // laghoH // abiBrajat is allowed by 7.4.3. - assert_has_lun_p( + assert_has_tip( &[], &nic(&d("wuBrAjf~\\", Bhvadi)), + Lun, &["abiBrajat", "abaBrAjat"], ); // laghuni - assert_has_lun_p(&[], &nic(&d("takzU~", Bhvadi)), &["atatakzat"]); - assert_has_lun_p(&[], &nic(&d("rakza~", Bhvadi)), &["ararakzat"]); + assert_has_tip(&[], &nic(&d("takzU~", Bhvadi)), Lun, &["atatakzat"]); + assert_has_tip(&[], &nic(&d("rakza~", Bhvadi)), Lun, &["ararakzat"]); // caNi assert_has_mip(&[], &pac, Lit, &["papaca", "papAca"]); // pare - assert_has_lun_a(&[], &d("kamu~\\", Bhvadi), &["acakamata", "acIkamata"]); + assert_has_ta(&[], &d("kamu~\\", Bhvadi), Lun, &["acakamata", "acIkamata"]); // anaglopa - assert_has_lun_p(&[], &d("kaTa", Curadi), &["acakaTat"]); + assert_has_tip(&[], &d("kaTa", Curadi), Lun, &["acakaTat"]); } #[test] fn sutra_7_4_95() { - assert_has_lun_p(&[], &nic(&d("smf", Bhvadi)), &["asasmarat"]); - assert_has_lun_p(&[], &nic(&d("dF", Bhvadi)), &["adadarat"]); - assert_has_lun_p(&[], &nic(&d("YitvarA~\\", Bhvadi)), &["atatvarat"]); - assert_has_lun_p(&[], &d("praTa~", Curadi), &["apapraTat"]); - assert_has_lun_p(&[], &nic(&d("mrada~\\", Bhvadi)), &["amamradat"]); - assert_has_lun_p(&[], &nic(&d("stFY", Kryadi)), &["atastarat"]); - assert_has_lun_p(&[], &nic(&d("spaSa~^", Bhvadi)), &["apaspaSat"]); + assert_has_tip(&[], &nic(&d("smf", Bhvadi)), Lun, &["asasmarat"]); + assert_has_tip(&[], &nic(&d("dF", Bhvadi)), Lun, &["adadarat"]); + assert_has_tip(&[], &nic(&d("YitvarA~\\", Bhvadi)), Lun, &["atatvarat"]); + assert_has_tip(&[], &d("praTa~", Curadi), Lun, &["apapraTat"]); + assert_has_tip(&[], &nic(&d("mrada~\\", Bhvadi)), Lun, &["amamradat"]); + assert_has_tip(&[], &nic(&d("stFY", Kryadi)), Lun, &["atastarat"]); + assert_has_tip(&[], &nic(&d("spaSa~^", Bhvadi)), Lun, &["apaspaSat"]); } #[test] fn sutra_7_4_96() { let vest = d("vezwa~\\", Bhvadi); let cest = d("cezwa~\\", Bhvadi); - assert_has_lun_p(&[], &nic(&vest), &["avavezwat", "avivezwat"]); - assert_has_lun_p(&[], &nic(&cest), &["acacezwat", "acicezwat"]); + assert_has_tip(&[], &nic(&vest), Lun, &["avavezwat", "avivezwat"]); + assert_has_tip(&[], &nic(&cest), Lun, &["acacezwat", "acicezwat"]); } #[test] fn sutra_7_4_97() { let gan = d("gaRa", Curadi); - assert_has_lun_p(&[], &gan, &["ajIgaRat", "ajagaRat"]); + assert_has_tip(&[], &gan, Lun, &["ajIgaRat", "ajagaRat"]); } diff --git a/vidyut-prakriya/tests/kashika_8_2.rs b/vidyut-prakriya/tests/kashika_8_2.rs index 5c74281..3e075af 100644 --- a/vidyut-prakriya/tests/kashika_8_2.rs +++ b/vidyut-prakriya/tests/kashika_8_2.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -71,7 +72,7 @@ fn sutra_8_2_18() { assert_has_ta(&[], &kfp, Lut, &["kalptA", "kalpitA"]); assert_has_aataam(&[], &kfp, Lut, &["kalptArO", "kalpitArO"]); assert_has_jha(&[], &kfp, Lut, &["kalptAraH", "kalpitAraH"]); - assert_has_lat_p(&[], &san(&kfp), &["cikxpsati"]); + assert_has_tip(&[], &san(&kfp), Lat, &["cikxpsati"]); assert_has_krdanta(&[], &kfp, Krt::kta, &["kxpta"]); assert_has_krdanta(&[], &kfp, Krt::ktavatu, &["kxptavat"]); } @@ -79,19 +80,19 @@ fn sutra_8_2_18() { #[test] fn sutra_8_2_19() { let ay = d("aya~\\", Bhvadi); - assert_has_lat_a(&["pra"], &ay, &["plAyate"]); - assert_has_lat_a(&["parA"], &ay, &["palAyate"]); - assert_has_lat_a(&["pari"], &ay, &["palyayate"]); + assert_has_ta(&["pra"], &ay, Lat, &["plAyate"]); + assert_has_ta(&["parA"], &ay, Lat, &["palAyate"]); + assert_has_ta(&["pari"], &ay, Lat, &["palyayate"]); - assert_has_lat_a(&["prati"], &ay, &["pratyayate"]); + assert_has_ta(&["prati"], &ay, Lat, &["pratyayate"]); assert_has_krdanta(&["nis"], &ay, Krt::lyuw, &["nirayaRa"]); assert_has_krdanta(&["dus"], &ay, Krt::lyuw, &["durayaRa"]); // extra examples from the Siddhantakaumudi - assert_has_lat_a(&["nis"], &ay, &["nirayate"]); - assert_has_lat_a(&["dus"], &ay, &["durayate"]); - assert_has_lat_a(&["nir"], &ay, &["nilayate"]); - assert_has_lat_a(&["dur"], &ay, &["dulayate"]); + assert_has_ta(&["nis"], &ay, Lat, &["nirayate"]); + assert_has_ta(&["dus"], &ay, Lat, &["durayate"]); + assert_has_ta(&["nir"], &ay, Lat, &["nilayate"]); + assert_has_ta(&["dur"], &ay, Lat, &["dulayate"]); } #[test] @@ -101,7 +102,7 @@ fn sutra_8_2_20() { assert_has_aataam(&["ni"], &yan(&gf), Lat, &["nijegilyete"]); assert_has_jha(&["ni"], &yan(&gf), Lat, &["nijegilyante"]); // yaNi - assert_has_lat_karmani(&["ni"], &gf, &["nigIryate"]); + assert_has_ta_k(&["ni"], &gf, Lat, &["nigIryate"]); } #[test] @@ -184,8 +185,8 @@ fn sutra_8_2_27() { assert_has_thaas(&[], &hf, Lun, &["ahfTAH"]); // hrasvAt? - assert_has_lun_a(&[], &d("cyu\\N", Bhvadi), &["acyozwa"]); - assert_has_lun_a(&[], &d("plu\\N", Bhvadi), &["aplozwa"]); + assert_has_ta(&[], &d("cyu\\N", Bhvadi), Lun, &["acyozwa"]); + assert_has_ta(&[], &d("plu\\N", Bhvadi), Lun, &["aplozwa"]); // aNgAt? let lu = d("lUY", Kryadi); @@ -202,15 +203,15 @@ fn sutra_8_2_27() { #[test] fn sutra_8_2_28() { // TODO: adAvIt? - // assert_has_lun_p(&[], &d("du\\", Bhvadi), &["adAvIt"]); - assert_has_lun_p(&[], &d("lUY", Kryadi), &["alAvIt"]); - assert_has_lun_p(&[], &d("zivu~", Divadi), &["asevIt"]); - assert_has_lun_p(&[], &d("kuza~", Kryadi), &["akozIt"]); - assert_has_lun_p(&[], &d("muza~", Kryadi), &["amozIt"]); + // assert_has_tip(&[], &d("du\\", Bhvadi), Lun, &["adAvIt"]); + assert_has_tip(&[], &d("lUY", Kryadi), Lun, &["alAvIt"]); + assert_has_tip(&[], &d("zivu~", Divadi), Lun, &["asevIt"]); + assert_has_tip(&[], &d("kuza~", Kryadi), Lun, &["akozIt"]); + assert_has_tip(&[], &d("muza~", Kryadi), Lun, &["amozIt"]); // iwaH? - assert_has_lun_p(&[], &d("qukf\\Y", Tanadi), &["akArzIt"]); - assert_has_lun_p(&[], &d("hf\\Y", Bhvadi), &["ahArzIt"]); + assert_has_tip(&[], &d("qukf\\Y", Tanadi), Lun, &["akArzIt"]); + assert_has_tip(&[], &d("hf\\Y", Bhvadi), Lun, &["ahArzIt"]); // Iwi? let lu = d("lUY", Kryadi); @@ -390,7 +391,7 @@ fn sutra_8_2_37() { assert_has_krdanta(&[], &budh, Krt::kvip, &["But"]); let guh = d("guhU~^", Bhvadi); - assert_has_lrt_a(&["ni"], &guh, &["niGokzyate", "nigUhizyate"]); + assert_has_ta(&["ni"], &guh, Lrt, &["niGokzyate", "nigUhizyate"]); assert_has_dhvam( &["ni"], &guh, @@ -400,7 +401,7 @@ fn sutra_8_2_37() { assert_has_krdanta(&[], &guh, Krt::kvip, &["Guw"]); let duh = d("du\\ha~^", Adadi); - assert_has_lrt_a(&[], &duh, &["Dokzyate"]); + assert_has_ta(&[], &duh, Lrt, &["Dokzyate"]); assert_has_dhvam(&[], &duh, Lun, &["aDugDvam", "aDukzaDvam"]); assert_has_krdanta(&[], &duh, Krt::kvip, &["Duk"]); @@ -408,7 +409,7 @@ fn sutra_8_2_37() { assert_has_lrt(&[], &d("kru\\Da~", Divadi), &["krotsyati"]); // Jazantasya? - assert_has_lrt_p(&[], &d("qudA\\Y", Juhotyadi), &["dAsyati"]); + assert_has_tip(&[], &d("qudA\\Y", Juhotyadi), Lrt, &["dAsyati"]); // sDvoH? assert_has_krdanta(&[], &budh, Krt::tfc, &["bodDf"]); @@ -487,13 +488,13 @@ fn sutra_8_2_41() { assert_has_lat(&[], &san(&pish), &["pipikzati"]); let lih = d("li\\ha~^", Adadi); - assert_has_lrt_p(&[], &lih, &["lekzyati"]); - assert_has_lrn_p(&[], &lih, &["alekzyat"]); - assert_has_lat_p(&[], &san(&lih), &["lilikzati"]); + assert_has_tip(&[], &lih, Lrt, &["lekzyati"]); + assert_has_tip(&[], &lih, Lrn, &["alekzyat"]); + assert_has_tip(&[], &san(&lih), Lat, &["lilikzati"]); // si? - assert_has_lat_p(&[], &pish, &["pinazwi"]); - assert_has_lat_p(&[], &lih, &["leQi"]); + assert_has_tip(&[], &pish, Lat, &["pinazwi"]); + assert_has_tip(&[], &lih, Lat, &["leQi"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_8_3.rs b/vidyut-prakriya/tests/kashika_8_3.rs index 83d3a05..0cbdf39 100644 --- a/vidyut-prakriya/tests/kashika_8_3.rs +++ b/vidyut-prakriya/tests/kashika_8_3.rs @@ -1,9 +1,9 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; -use vidyut_prakriya::args::*; #[test] fn sutra_8_3_13() { @@ -71,8 +71,8 @@ fn sutra_8_3_23() { assert_has_sandhi("kim", "atra", &["kim atra"]); // padAntasya - assert_has_lat_karmani(&[], &d("ga\\mx~", Bhvadi), &["gamyate"]); - assert_has_lat_karmani(&[], &d("ra\\ma~\\", Bhvadi), &["ramyate"]); + assert_has_ta_k(&[], &d("ga\\mx~", Bhvadi), Lat, &["gamyate"]); + assert_has_ta_k(&[], &d("ra\\ma~\\", Bhvadi), Lat, &["ramyate"]); } #[ignore] @@ -85,13 +85,13 @@ fn sutra_8_3_24() { // makArasya let kram = d("kramu~", Bhvadi); - assert_has_lrt_a(&["AN"], &kram, &["AkraMsyate"]); - assert_has_lat_karmani(&["AN"], &san(&kram), &["AcikraMsyate"]); + assert_has_ta(&["AN"], &kram, Lrt, &["AkraMsyate"]); + assert_has_ta_k(&["AN"], &san(&kram), Lat, &["AcikraMsyate"]); assert_has_lat(&["aDi"], &san(&d("i\\N", Adadi)), &["aDijigaMsate"]); // Jali - assert_has_lat_karmani(&[], &d("ra\\ma~\\", Bhvadi), &["ramyate"]); - assert_has_lat_karmani(&[], &d("ga\\mx~", Bhvadi), &["gamyate"]); + assert_has_ta_k(&[], &d("ra\\ma~\\", Bhvadi), Lat, &["ramyate"]); + assert_has_ta_k(&[], &d("ga\\mx~", Bhvadi), Lat, &["gamyate"]); } #[test] @@ -130,8 +130,8 @@ fn sutra_8_3_36() { #[test] fn sutra_8_3_55() { - assert_has_lit_p(&[], &d("zi\\ca~^", Tudadi), &["sizeca"]); - assert_has_lit_p(&[], &d("Yizva\\pa~", Adadi), &["suzvApa"]); + assert_has_tip(&[], &d("zi\\ca~^", Tudadi), Lit, &["sizeca"]); + assert_has_tip(&[], &d("Yizva\\pa~", Adadi), Lit, &["suzvApa"]); assert_has_sup_7p("agni", Pum, &["agnizu"]); assert_has_sup_7p("vAyu", Pum, &["vAyuzu"]); @@ -167,30 +167,35 @@ fn sutra_8_3_60() { fn sutra_8_3_61() { let svap = d("Yizva\\pa~", Adadi); let sic = d("zi\\ca~^", Tudadi); - assert_has_lat_p(&[], &san(&d("zwu\\Y", Adadi)), &["tuzwUzati"]); - assert_has_lat_p(&[], &nic_san(&d("zevf~\\", Bhvadi)), &["sizevayizati"]); - assert_has_lat_p(&[], &nic_san(&d("za\\nja~", Bhvadi)), &["sizaYjayizati"]); - assert_has_lat_p(&[], &nic_san(&svap), &["suzvApayizati"]); - assert_has_lat_p(&[], &san(&sic), &["sisikzati"]); - assert_has_lat_p(&[], &san(&d("zu\\", Bhvadi)), &["susUzati"]); + assert_has_tip(&[], &san(&d("zwu\\Y", Adadi)), Lat, &["tuzwUzati"]); + assert_has_tip(&[], &nic_san(&d("zevf~\\", Bhvadi)), Lat, &["sizevayizati"]); + assert_has_tip( + &[], + &nic_san(&d("za\\nja~", Bhvadi)), + Lat, + &["sizaYjayizati"], + ); + assert_has_tip(&[], &nic_san(&svap), Lat, &["suzvApayizati"]); + assert_has_tip(&[], &san(&sic), Lat, &["sisikzati"]); + assert_has_tip(&[], &san(&d("zu\\", Bhvadi)), Lat, &["susUzati"]); // zaRi - assert_has_lit_p(&[], &sic, &["sizeca"]); + assert_has_tip(&[], &sic, Lit, &["sizeca"]); assert_has_lat(&[], &san(&svap), &["suzupsati"]); - assert_has_lat_p(&[], &san(&d("zWA\\", Bhvadi)), &["tizWAsati"]); + assert_has_tip(&[], &san(&d("zWA\\", Bhvadi)), Lat, &["tizWAsati"]); // TODO: others } #[test] fn sutra_8_3_63() { let su = d("zu\\Y", Svadi); - assert_has_lat_p(&["aBi"], &su, &["aBizuRoti"]); - assert_has_lat_p(&["pari"], &su, &["parizuRoti"]); - assert_has_lat_p(&["vi"], &su, &["vizuRoti"]); - assert_has_lat_p(&["ni"], &su, &["nizuRoti"]); - assert_has_lan_p(&["aBi"], &su, &["aByazuRot"]); - assert_has_lan_p(&["pari"], &su, &["paryazuRot"]); - assert_has_lan_p(&["vi"], &su, &["vyazuRot"]); - assert_has_lan_p(&["ni"], &su, &["nyazuRot"]); + assert_has_tip(&["aBi"], &su, Lat, &["aBizuRoti"]); + assert_has_tip(&["pari"], &su, Lat, &["parizuRoti"]); + assert_has_tip(&["vi"], &su, Lat, &["vizuRoti"]); + assert_has_tip(&["ni"], &su, Lat, &["nizuRoti"]); + assert_has_tip(&["aBi"], &su, Lan, &["aByazuRot"]); + assert_has_tip(&["pari"], &su, Lan, &["paryazuRot"]); + assert_has_tip(&["vi"], &su, Lan, &["vyazuRot"]); + assert_has_tip(&["ni"], &su, Lan, &["nyazuRot"]); } #[test] @@ -198,42 +203,52 @@ fn sutra_8_3_64() { // TODO: others let stha = d("zWA\\", Bhvadi); - assert_has_lit_p(&["aBi"], &stha, &["aBitazWO"]); - assert_has_lit_p(&["pari"], &stha, &["paritazWO"]); + assert_has_tip(&["aBi"], &stha, Lit, &["aBitazWO"]); + assert_has_tip(&["pari"], &stha, Lit, &["paritazWO"]); } #[test] fn sutra_8_3_66() { let sad = d("za\\dx~", Bhvadi); - assert_has_lat_p(&["ni"], &sad, &["nizIdati"]); - assert_has_lat_p(&["vi"], &sad, &["vizIdati"]); + assert_has_tip(&["ni"], &sad, Lat, &["nizIdati"]); + assert_has_tip(&["vi"], &sad, Lat, &["vizIdati"]); - assert_has_lan_p(&["ni"], &sad, &["nyazIdat"]); - assert_has_lan_p(&["vi"], &sad, &["vyazIdat"]); + assert_has_tip(&["ni"], &sad, Lan, &["nyazIdat"]); + assert_has_tip(&["vi"], &sad, Lan, &["vyazIdat"]); - assert_has_lit_p(&["ni"], &sad, &["nizasAda"]); - assert_has_lit_p(&["vi"], &sad, &["vizasAda"]); + assert_has_tip(&["ni"], &sad, Lit, &["nizasAda"]); + assert_has_tip(&["vi"], &sad, Lit, &["vizasAda"]); - assert_has_lat_p(&["prati"], &sad, &["pratisIdati"]); + assert_has_tip(&["prati"], &sad, Lat, &["pratisIdati"]); } #[test] fn sutra_8_3_67() { let stanbh = d("stanBu~", Kryadi); - assert_has_lat_p(&["aBi"], &stanbh, &["aBizwaBnAti", "aBizwaBnoti"]); - assert_has_lat_p(&["pari"], &stanbh, &["parizwaBnAti", "parizwaBnoti"]); + assert_has_tip(&["aBi"], &stanbh, Lat, &["aBizwaBnAti", "aBizwaBnoti"]); + assert_has_tip(&["pari"], &stanbh, Lat, &["parizwaBnAti", "parizwaBnoti"]); - assert_has_lan_p(&["aBi"], &stanbh, &["aByazwaBnAt", "aByazwaBnot"]); - assert_has_lan_p(&["pari"], &stanbh, &["paryazwaBnAt", "paryazwaBnot"]); + assert_has_tip(&["aBi"], &stanbh, Lan, &["aByazwaBnAt", "aByazwaBnot"]); + assert_has_tip(&["pari"], &stanbh, Lan, &["paryazwaBnAt", "paryazwaBnot"]); - assert_has_lit_p(&["aBi"], &stanbh, &["aBitazwamBa"]); - assert_has_lit_p(&["pari"], &stanbh, &["paritazwamBa"]); + assert_has_tip(&["aBi"], &stanbh, Lit, &["aBitazwamBa"]); + assert_has_tip(&["pari"], &stanbh, Lit, &["paritazwamBa"]); - assert_has_lat_p(&["prati"], &stanbh, &["pratizwaBnAti", "pratizwaBnoti"]); - assert_has_lan_p(&["prati"], &stanbh, &["pratyazwaBnAt", "pratyazwaBnot"]); - assert_has_lit_p(&["prati"], &stanbh, &["pratitazwamBa"]); + assert_has_tip( + &["prati"], + &stanbh, + Lat, + &["pratizwaBnAti", "pratizwaBnoti"], + ); + assert_has_tip( + &["prati"], + &stanbh, + Lan, + &["pratyazwaBnAt", "pratyazwaBnot"], + ); + assert_has_tip(&["prati"], &stanbh, Lit, &["pratitazwamBa"]); } #[test] @@ -246,13 +261,13 @@ fn sutra_8_3_68() { fn sutra_8_3_69() { let svan = d("svana~", Bhvadi); - assert_has_lat_p(&["vi"], &svan, &["vizvaRati", "visvanati"]); - assert_has_lan_p(&["vi"], &svan, &["vyazvaRat", "vyasvanat"]); - assert_has_lit_p(&["vi"], &svan, &["vizazvARa", "visasvAna"]); + assert_has_tip(&["vi"], &svan, Lat, &["vizvaRati", "visvanati"]); + assert_has_tip(&["vi"], &svan, Lan, &["vyazvaRat", "vyasvanat"]); + assert_has_tip(&["vi"], &svan, Lit, &["vizazvARa", "visasvAna"]); - assert_has_lat_p(&["ava"], &svan, &["avazvaRati", "avasvanati"]); - assert_has_lan_p(&["ava"], &svan, &["avAzvaRat", "avAsvanat"]); - assert_has_lit_p(&["ava"], &svan, &["avazazvARa", "avasasvAna"]); + assert_has_tip(&["ava"], &svan, Lat, &["avazvaRati", "avasvanati"]); + assert_has_tip(&["ava"], &svan, Lan, &["avAzvaRat", "avAsvanat"]); + assert_has_tip(&["ava"], &svan, Lit, &["avazazvARa", "avasasvAna"]); } #[test] @@ -288,7 +303,7 @@ fn sutra_8_3_70() { /* let kr = d("qukf\\Y", Tanadi); - assert_has_lat_p(&["pari"], &kr, &["parizkaroti", "parikaroti"]); + assert_has_tip(&["pari"], &kr, Lat, &["parizkaroti", "parikaroti"]); assert_has_lan_p( &["pari"], &kr, @@ -297,22 +312,25 @@ fn sutra_8_3_70() { */ let stu = d("zwu\\Y", Adadi); - assert_has_lat_p(&["pari"], &stu, &["parizwOti", "parizwavIti"]); - assert_has_lat_p(&["ni"], &stu, &["nizwOti", "nizwavIti"]); - assert_has_lat_p(&["vi"], &stu, &["vizwOti", "vizwavIti"]); - assert_has_lan_p( + assert_has_tip(&["pari"], &stu, Lat, &["parizwOti", "parizwavIti"]); + assert_has_tip(&["ni"], &stu, Lat, &["nizwOti", "nizwavIti"]); + assert_has_tip(&["vi"], &stu, Lat, &["vizwOti", "vizwavIti"]); + assert_has_tip( &["pari"], &stu, + Lan, &["paryazwOt", "paryastOt", "paryazwavIt", "paryastavIt"], ); - assert_has_lan_p( + assert_has_tip( &["ni"], &stu, + Lan, &["nyazwOt", "nyastOt", "nyazwavIt", "nyastavIt"], ); - assert_has_lan_p( + assert_has_tip( &["vi"], &stu, + Lan, &["vyazwOt", "vyastOt", "vyazwavIt", "vyastavIt"], ); @@ -449,16 +467,16 @@ fn sutra_8_3_112() { assert_has_lat(&[], &yan(&sic), &["sesicyate"]); assert_has_lat(&["aBi"], &yan(&sic), &["aBisesicyate"]); // yani - assert_has_lat_p(&["aBi"], &san(&sic), &["aBizizikzati"]); + assert_has_tip(&["aBi"], &san(&sic), Lat, &["aBizizikzati"]); } #[test] fn sutra_8_3_113() { let sidh = d("ziDa~", Bhvadi); - assert_has_lat_p(&["aBi"], &nic(&sidh), &["aBiseDayati"]); - assert_has_lat_p(&["pari"], &nic(&sidh), &["pariseDayati"]); + assert_has_tip(&["aBi"], &nic(&sidh), Lat, &["aBiseDayati"]); + assert_has_tip(&["pari"], &nic(&sidh), Lat, &["pariseDayati"]); // gatau? - assert_has_lat_p(&["prati"], &nic(&sidh), &["pratizeDayati"]); + assert_has_tip(&["prati"], &nic(&sidh), Lat, &["pratizeDayati"]); } #[test] @@ -480,16 +498,16 @@ fn sutra_8_3_115() { #[test] fn sutra_8_3_117() { let sush = d("zu\\Y", Svadi); - assert_has_lrt_p(&["aBi"], &sush, &["aBisozyati"]); - assert_has_lrt_p(&["pari"], &sush, &["parisozyati"]); - assert_has_lrn_p(&["aBi"], &sush, &["aByasozyat"]); - assert_has_lrn_p(&["pari"], &sush, &["paryasozyat"]); + assert_has_tip(&["aBi"], &sush, Lrt, &["aBisozyati"]); + assert_has_tip(&["pari"], &sush, Lrt, &["parisozyati"]); + assert_has_tip(&["aBi"], &sush, Lrn, &["aByasozyat"]); + assert_has_tip(&["pari"], &sush, Lrn, &["paryasozyat"]); // sani? assert_has_lat(&["aBi"], &san(&sush), &["aBisusUzati", "aBisusUzate"]); // syasanoH? - assert_has_lit_p(&[], &sush, &["suzAva"]); + assert_has_tip(&[], &sush, Lit, &["suzAva"]); // TODO: aBisusUH } @@ -497,7 +515,7 @@ fn sutra_8_3_117() { #[test] fn sutra_8_3_118() { let sad = d("za\\dx~", Bhvadi); - assert_has_lit_p(&["ni"], &sad, &["nizasAda"]); + assert_has_tip(&["ni"], &sad, Lit, &["nizasAda"]); } #[test] diff --git a/vidyut-prakriya/tests/kashika_8_4.rs b/vidyut-prakriya/tests/kashika_8_4.rs index 2f1ce0d..7b68169 100644 --- a/vidyut-prakriya/tests/kashika_8_4.rs +++ b/vidyut-prakriya/tests/kashika_8_4.rs @@ -1,5 +1,6 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; use vidyut_prakriya::args::Lakara::*; use vidyut_prakriya::args::Linga::*; @@ -13,9 +14,9 @@ fn sutra_8_4_1() { assert_has_krdanta(&["ava"], &d("gUrI~\\", Divadi), Krt::kta, &["avagUrRa"]); // za - assert_has_lat_p(&[], &d("kuza~", Kryadi), &["kuzRAti"]); - assert_has_lat_p(&[], &d("puza~", Kryadi), &["puzRAti"]); - assert_has_lat_p(&[], &d("muza~", Kryadi), &["muzRAti"]); + assert_has_tip(&[], &d("kuza~", Kryadi), Lat, &["kuzRAti"]); + assert_has_tip(&[], &d("puza~", Kryadi), Lat, &["puzRAti"]); + assert_has_tip(&[], &d("muza~", Kryadi), Lat, &["muzRAti"]); // TODO: samAnapade assert_has_sandhi("agnis", "nayati", &["agnir nayati"]); @@ -75,15 +76,15 @@ fn sutra_8_4_2() { #[test] fn sutra_8_4_14() { let nam = d("Ra\\ma~", Bhvadi); - assert_has_lat(&["pra"], &nam, &["praRamati"]); - assert_has_lat(&["pari"], &nam, &["pariRamati"]); + assert_has_tip(&["pra"], &nam, Lat, &["praRamati"]); + assert_has_tip(&["pari"], &nam, Lat, &["pariRamati"]); let ni = d("RI\\Y", Bhvadi); assert_has_krdanta(&["pra"], &ni, Krt::Rvul, &["praRAyaka"]); assert_has_krdanta(&["pari"], &ni, Krt::Rvul, &["pariRAyaka"]); let nard = d("narda~", Bhvadi); - assert_has_lat(&["pra"], &nard, &["pranardati"]); + assert_has_tip(&["pra"], &nard, Lat, &["pranardati"]); assert_has_krdanta(&["pra"], &nard, Krt::Rvul, &["pranardaka"]); } @@ -91,8 +92,8 @@ fn sutra_8_4_14() { fn sutra_8_4_15() { let hi = d("hi\\", Svadi); let mi = d("mI\\Y", Kryadi); - assert_has_lat(&["pra"], &hi, &["prahiRoti"]); - assert_has_lat_p(&["pra"], &mi, &["pramIRAti"]); + assert_has_tip(&["pra"], &hi, Lat, &["prahiRoti"]); + assert_has_tip(&["pra"], &mi, Lat, &["pramIRAti"]); } #[test] @@ -108,106 +109,111 @@ fn sutra_8_4_16() { #[test] fn sutra_8_4_17() { let gad = d("gada~", Bhvadi); - assert_has_lat(&["pra", "ni"], &gad, &["praRigadati"]); - assert_has_lat(&["pari", "ni"], &gad, &["pariRigadati"]); + assert_has_tip(&["pra", "ni"], &gad, Lat, &["praRigadati"]); + assert_has_tip(&["pari", "ni"], &gad, Lat, &["pariRigadati"]); let nad = d("Rada~", Bhvadi); - assert_has_lat(&["pra", "ni"], &nad, &["praRinadati"]); - assert_has_lat(&["pari", "ni"], &nad, &["pariRinadati"]); + assert_has_tip(&["pra", "ni"], &nad, Lat, &["praRinadati"]); + assert_has_tip(&["pari", "ni"], &nad, Lat, &["pariRinadati"]); let pat = d("patx~", Bhvadi); - assert_has_lat(&["pra", "ni"], &pat, &["praRipatati"]); - assert_has_lat(&["pari", "ni"], &pat, &["pariRipatati"]); + assert_has_tip(&["pra", "ni"], &pat, Lat, &["praRipatati"]); + assert_has_tip(&["pari", "ni"], &pat, Lat, &["pariRipatati"]); let pad = d("pa\\da~\\", Divadi); - assert_has_lat(&["pra", "ni"], &pad, &["praRipadyate"]); - assert_has_lat(&["pari", "ni"], &pad, &["pariRipadyate"]); + assert_has_ta(&["pra", "ni"], &pad, Lat, &["praRipadyate"]); + assert_has_ta(&["pari", "ni"], &pad, Lat, &["pariRipadyate"]); let daa = d("qudA\\Y", Juhotyadi); - assert_has_lat_p(&["pra", "ni"], &daa, &["praRidadAti"]); - assert_has_lat_p(&["pari", "ni"], &daa, &["pariRidadAti"]); + assert_has_tip(&["pra", "ni"], &daa, Lat, &["praRidadAti"]); + assert_has_tip(&["pari", "ni"], &daa, Lat, &["pariRidadAti"]); let dhaa = d("quDA\\Y", Juhotyadi); - assert_has_lat_p(&["pra", "ni"], &dhaa, &["praRidaDAti"]); - assert_has_lat_p(&["pari", "ni"], &dhaa, &["pariRidaDAti"]); + assert_has_tip(&["pra", "ni"], &dhaa, Lat, &["praRidaDAti"]); + assert_has_tip(&["pari", "ni"], &dhaa, Lat, &["pariRidaDAti"]); let maa = d("mA\\N", Juhotyadi); - assert_has_lat(&["pra", "ni"], &maa, &["praRimimIte"]); - assert_has_lat(&["pari", "ni"], &maa, &["pariRimimIte"]); + assert_has_ta(&["pra", "ni"], &maa, Lat, &["praRimimIte"]); + assert_has_ta(&["pari", "ni"], &maa, Lat, &["pariRimimIte"]); let me = d("me\\N", Bhvadi); - assert_has_lat(&["pra", "ni"], &me, &["praRimayate"]); - assert_has_lat(&["pari", "ni"], &me, &["pariRimayate"]); + assert_has_ta(&["pra", "ni"], &me, Lat, &["praRimayate"]); + assert_has_ta(&["pari", "ni"], &me, Lat, &["pariRimayate"]); let so = d("zo\\", Divadi); - assert_has_lat(&["pra", "ni"], &so, &["praRizyati"]); - assert_has_lat(&["pari", "ni"], &so, &["pariRizyati"]); + assert_has_tip(&["pra", "ni"], &so, Lat, &["praRizyati"]); + assert_has_tip(&["pari", "ni"], &so, Lat, &["pariRizyati"]); let han = d("ha\\na~", Adadi); - assert_has_lat(&["pra", "ni"], &han, &["praRihanti"]); - assert_has_lat(&["pari", "ni"], &han, &["pariRihanti"]); + assert_has_tip(&["pra", "ni"], &han, Lat, &["praRihanti"]); + assert_has_tip(&["pari", "ni"], &han, Lat, &["pariRihanti"]); let yaa = d("yA\\", Adadi); - assert_has_lat(&["pra", "ni"], &yaa, &["praRiyAti"]); - assert_has_lat(&["pari", "ni"], &yaa, &["pariRiyAti"]); + assert_has_tip(&["pra", "ni"], &yaa, Lat, &["praRiyAti"]); + assert_has_tip(&["pari", "ni"], &yaa, Lat, &["pariRiyAti"]); let vaa = d("vA\\", Adadi); - assert_has_lat(&["pra", "ni"], &vaa, &["praRivAti"]); - assert_has_lat(&["pari", "ni"], &vaa, &["pariRivAti"]); + assert_has_tip(&["pra", "ni"], &vaa, Lat, &["praRivAti"]); + assert_has_tip(&["pari", "ni"], &vaa, Lat, &["pariRivAti"]); let draa = d("drA\\", Adadi); - assert_has_lat(&["pra", "ni"], &draa, &["praRidrAti"]); - assert_has_lat(&["pari", "ni"], &draa, &["pariRidrAti"]); + assert_has_tip(&["pra", "ni"], &draa, Lat, &["praRidrAti"]); + assert_has_tip(&["pari", "ni"], &draa, Lat, &["pariRidrAti"]); let psaa = d("psA\\", Adadi); - assert_has_lat(&["pra", "ni"], &psaa, &["praRipsAti"]); - assert_has_lat(&["pari", "ni"], &psaa, &["pariRipsAti"]); + assert_has_tip(&["pra", "ni"], &psaa, Lat, &["praRipsAti"]); + assert_has_tip(&["pari", "ni"], &psaa, Lat, &["pariRipsAti"]); let vap = d("quva\\pa~^", Bhvadi); - assert_has_lat_p(&["pra", "ni"], &vap, &["praRivapati"]); - assert_has_lat_p(&["pari", "ni"], &vap, &["pariRivapati"]); + assert_has_tip(&["pra", "ni"], &vap, Lat, &["praRivapati"]); + assert_has_tip(&["pari", "ni"], &vap, Lat, &["pariRivapati"]); let vah = d("va\\ha~^", Bhvadi); - assert_has_lat_p(&["pra", "ni"], &vah, &["praRivahati"]); - assert_has_lat_p(&["pari", "ni"], &vah, &["pariRivahati"]); + assert_has_tip(&["pra", "ni"], &vah, Lat, &["praRivahati"]); + assert_has_tip(&["pari", "ni"], &vah, Lat, &["pariRivahati"]); let sham = d("Samu~", Divadi); - assert_has_lat(&["pra", "ni"], &sham, &["praRiSAmyati"]); - assert_has_lat(&["pari", "ni"], &sham, &["pariRiSAmyati"]); + assert_has_tip(&["pra", "ni"], &sham, Lat, &["praRiSAmyati"]); + assert_has_tip(&["pari", "ni"], &sham, Lat, &["pariRiSAmyati"]); let ci = d("ci\\Y", Svadi); - assert_has_lat_p(&["pra", "ni"], &ci, &["praRicinoti"]); - assert_has_lat_p(&["pari", "ni"], &ci, &["pariRicinoti"]); + assert_has_tip(&["pra", "ni"], &ci, Lat, &["praRicinoti"]); + assert_has_tip(&["pari", "ni"], &ci, Lat, &["pariRicinoti"]); let dih = d("di\\ha~^", Adadi); - assert_has_lat_p(&["pra", "ni"], &dih, &["praRidegDi"]); - assert_has_lat_p(&["pari", "ni"], &dih, &["pariRidegDi"]); + assert_has_tip(&["pra", "ni"], &dih, Lat, &["praRidegDi"]); + assert_has_tip(&["pari", "ni"], &dih, Lat, &["pariRidegDi"]); // Also applies for aw-vyavAya - assert_has_lan(&["pra", "ni"], &gad, &["praRyagadat"]); - assert_has_lan(&["pari", "ni"], &gad, &["pariRyagadat"]); + assert_has_tip(&["pra", "ni"], &gad, Lan, &["praRyagadat"]); + assert_has_tip(&["pari", "ni"], &gad, Lan, &["pariRyagadat"]); } #[test] fn sutra_8_4_18() { let pac = d("qupa\\ca~^z", Bhvadi); - assert_has_lat_p(&["pra", "ni"], &pac, &["praRipacati", "pranipacati"]); + assert_has_tip(&["pra", "ni"], &pac, Lat, &["praRipacati", "pranipacati"]); let bhid = d("Bi\\di~^r", Rudhadi); - assert_has_lat_p(&["pra", "ni"], &bhid, &["praRiBinatti", "praniBinatti"]); + assert_has_tip( + &["pra", "ni"], + &bhid, + Lat, + &["praRiBinatti", "praniBinatti"], + ); let kf = d("qukf\\Y", Tanadi); - assert_has_lat_p(&["pra", "ni"], &kf, &["pranikaroti"]); + assert_has_tip(&["pra", "ni"], &kf, Lat, &["pranikaroti"]); let khaad = d("KAdf~", Bhvadi); - assert_has_lat_p(&["pra", "ni"], &khaad, &["praniKAdati"]); + assert_has_tip(&["pra", "ni"], &khaad, Lat, &["praniKAdati"]); let pish = d("pi\\zx~", Rudhadi); - assert_has_lat_p(&["pra", "ni"], &pish, &["pranipinazwi"]); + assert_has_tip(&["pra", "ni"], &pish, Lat, &["pranipinazwi"]); // Examples of why the rule has "upadesha" - assert_has_lit_p(&["pra", "ni"], &kf, &["pranicakAra"]); - assert_has_lit_p(&["pra", "ni"], &khaad, &["pranicaKAda"]); + assert_has_tip(&["pra", "ni"], &kf, Lit, &["pranicakAra"]); + assert_has_tip(&["pra", "ni"], &khaad, Lit, &["pranicaKAda"]); assert_has_lrt(&["pra", "ni"], &pish, &["pranipekzyati"]); let vish = d("vi\\Sa~", Tudadi); @@ -219,25 +225,25 @@ fn sutra_8_4_18() { #[test] fn sutra_8_4_19() { let an = d("ana~", Adadi); - assert_has_lat(&["pra"], &an, &["prARiti"]); - assert_has_lat(&["parA"], &an, &["parARiti"]); + assert_has_tip(&["pra"], &an, Lat, &["prARiti"]); + assert_has_tip(&["parA"], &an, Lat, &["parARiti"]); } #[test] fn sutra_8_4_21() { let an = d("ana~", Adadi); let nic = |d: &Dhatu| d.clone().with_sanadi(&[Sanadi::Nic]); - assert_has_lat(&["pra"], &san(&an), &["prARiRizati"]); - assert_has_lun_p(&["pra"], &nic(&an), &["prARiRat"]); - assert_has_lat(&["parA"], &san(&an), &["parARiRizati"]); - assert_has_lun_p(&["parA"], &nic(&an), &["parARiRat"]); + assert_has_tip(&["pra"], &san(&an), Lat, &["prARiRizati"]); + assert_has_tip(&["pra"], &nic(&an), Lun, &["prARiRat"]); + assert_has_tip(&["parA"], &san(&an), Lat, &["parARiRizati"]); + assert_has_tip(&["parA"], &nic(&an), Lun, &["parARiRat"]); } #[test] fn sutra_8_4_22() { let han = d("ha\\na~", Adadi); - assert_has_lat_karmani(&["pra"], &han, &["prahaRyate"]); - assert_has_lat_karmani(&["pari"], &han, &["parihaRyate"]); + assert_has_ta_k(&["pra"], &han, Lat, &["prahaRyate"]); + assert_has_ta_k(&["pari"], &han, Lat, &["parihaRyate"]); assert_has_krdanta(&["pra"], &han, Krt::lyuw, &["prahaRana"]); assert_has_krdanta(&["pari"], &han, Krt::lyuw, &["parihaRana"]); @@ -246,8 +252,8 @@ fn sutra_8_4_22() { assert_has_jhi(&["pari"], &han, Lat, &["pariGnanti"]); // taparakaraRa - assert_has_lun_karmani(&["pra"], &han, &["prAGAni", "prAvaDi"]); - assert_has_lun_karmani(&["pari"], &han, &["paryaGAni", "paryavaDi"]); + assert_has_ta_k(&["pra"], &han, Lun, &["prAGAni", "prAvaDi"]); + assert_has_ta_k(&["pari"], &han, Lun, &["paryaGAni", "paryavaDi"]); } #[test] @@ -271,8 +277,8 @@ fn sutra_8_4_36() { assert_has_krdanta(&["pra"], &nas, Krt::kta, &["pranazwa"]); assert_has_krdanta(&["pari"], &nas, Krt::kta, &["parinazwa"]); // zAntasya - assert_has_lat(&["pra"], &nas, &["praRaSyati"]); - assert_has_lat(&["pari"], &nas, &["pariRaSyati"]); + assert_has_tip(&["pra"], &nas, Lat, &["praRaSyati"]); + assert_has_tip(&["pari"], &nas, Lat, &["pariRaSyati"]); // others assert_has_lrt(&["pra"], &nas, &["pranaNkzyati", "praRaSizyati"]); assert_has_lrt(&["pari"], &nas, &["parinaNkzyati", "pariRaSizyati"]); @@ -317,9 +323,9 @@ fn sutra_8_4_40() { assert_has_sandhi("agnicit", "YakAras", &["agniciY YakAraH"]); assert_has_sandhi("somasut", "YakAras", &["somasuY YakAraH"]); - assert_has_lat_p(&[], &d("wuma\\sjo~", Tudadi), &["majjati"]); - assert_has_lat_p(&[], &d("Bra\\sja~^", Tudadi), &["Bfjjati"]); - assert_has_lat_p(&[], &d("o~vrascU~", Tudadi), &["vfScati"]); + assert_has_tip(&[], &d("wuma\\sjo~", Tudadi), Lat, &["majjati"]); + assert_has_tip(&[], &d("Bra\\sja~^", Tudadi), Lat, &["Bfjjati"]); + assert_has_tip(&[], &d("o~vrascU~", Tudadi), Lat, &["vfScati"]); assert_has_krdanta(&[], &d("ya\\ja~^", Tudadi), Krt::naN, &["yajYa"]); assert_has_krdanta(&[], &d("quyAcf~^", Tudadi), Krt::naN, &["yAcYA"]); } @@ -338,7 +344,7 @@ fn sutra_8_4_41() { assert_has_krdanta(&[], &pish, Krt::tumun, &["pezwum"]); assert_has_krdanta(&[], &pish, Krt::tavya, &["pezwavya"]); let kf = d("qukf\\Y", Tanadi); - assert_has_ashirlin_a(&[], &kf, &["kfzIzwa"]); + assert_has_ta(&[], &kf, AshirLin, &["kfzIzwa"]); assert_has_thaas(&[], &kf, AshirLin, &["kfzIzWAH"]); assert_has_sandhi("agnicit", "wIkate", &["agniciw wIkate"]); @@ -361,7 +367,7 @@ fn sutra_8_4_42() { assert_has_sandhi("Svaliw", "sAye", &["Svaliw sAye", "Svaliw tsAye"]); assert_has_sandhi("maDuliw", "tarati", &["maDuliw tarati"]); // padAntAt? - assert_has_lat_a(&[], &d("Iqa~\\", Adadi), &["Iwwe"]); + assert_has_ta(&[], &d("Iqa~\\", Adadi), Lat, &["Iwwe"]); // woH? assert_has_taddhitanta(&prati("sarpis"), T::tamap, &["sarpizwama"]); // // an-Am? @@ -417,12 +423,12 @@ fn sutra_8_4_53() { #[test] fn sutra_8_4_54() { - assert_has_lat_p(&[], &san(&d("Kanu~^", Bhvadi)), &["ciKanizati"]); - assert_has_lat_p(&[], &san(&d("Ci\\di~^r", Rudhadi)), &["cicCitsati"]); - assert_has_lat_p(&[], &san(&d("zWA\\", Bhvadi)), &["tizWAsati"]); - assert_has_lat(&[], &san(&d("BU", Bhvadi)), &["buBUzati"]); - assert_has_lat(&[], &san(&d("a\\da~", Adadi)), &["jiGatsati"]); - assert_has_lat(&[], &san(&d("QOkf~\\", Bhvadi)), &["quQOkizate"]); + assert_has_tip(&[], &san(&d("Kanu~^", Bhvadi)), Lat, &["ciKanizati"]); + assert_has_tip(&[], &san(&d("Ci\\di~^r", Rudhadi)), Lat, &["cicCitsati"]); + assert_has_tip(&[], &san(&d("zWA\\", Bhvadi)), Lat, &["tizWAsati"]); + assert_has_tip(&[], &san(&d("BU", Bhvadi)), Lat, &["buBUzati"]); + assert_has_tip(&[], &san(&d("a\\da~", Adadi)), Lat, &["jiGatsati"]); + assert_has_ta(&[], &san(&d("QOkf~\\", Bhvadi)), Lat, &["quQOkizate"]); // TODO: others } @@ -432,9 +438,14 @@ fn sutra_8_4_55() { assert_has_krdanta(&[], &bhid, Krt::tfc, &["Bettf"]); assert_has_krdanta(&[], &bhid, Krt::tumun, &["Bettum"]); assert_has_krdanta(&[], &bhid, Krt::tavya, &["Bettavya"]); - assert_has_lat(&[], &san(&d("yu\\Da~\\", Divadi)), &["yuyutsate"]); - assert_has_lat(&["AN"], &san(&d("ra\\Ba~\\", Bhvadi)), &["Aripsate"]); - assert_has_lat(&["AN"], &san(&d("qula\\Ba~\\z", Bhvadi)), &["Alipsate"]); + assert_has_ta(&[], &san(&d("yu\\Da~\\", Divadi)), Lat, &["yuyutsate"]); + assert_has_ta(&["AN"], &san(&d("ra\\Ba~\\", Bhvadi)), Lat, &["Aripsate"]); + assert_has_ta( + &["AN"], + &san(&d("qula\\Ba~\\z", Bhvadi)), + Lat, + &["Alipsate"], + ); } #[test] @@ -508,3 +519,6 @@ fn sutra_8_4_63() { assert_has_sandhi("swaliw", "Sete", &["svaliw Cete", "svaliw Sete"]); assert_has_sandhi("trizWup", "Sete", &["trizWup Cete", "trizWup Sete"]); } + +#[test] +fn skip_sutra_8_4_68() {} diff --git a/vidyut-prakriya/tests/kaumudi_43.rs b/vidyut-prakriya/tests/kaumudi_43.rs index de9db97..71bcb4d 100644 --- a/vidyut-prakriya/tests/kaumudi_43.rs +++ b/vidyut-prakriya/tests/kaumudi_43.rs @@ -1,7 +1,7 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; -use vidyut_prakriya::args::Krt; use vidyut_prakriya::args::Lakara::*; #[test] @@ -2083,7 +2083,7 @@ fn sk_2313() { let kf = d("qukf\\Y", Tanadi); assert_has_krdanta(&[], &nic(&kf), Krt::Rvul, &["kAraka"]); - assert_has_lat_karmani(&[], &nic(&kf), &["kAryate"]); + assert_has_ta_k(&[], &nic(&kf), Lat, &["kAryate"]); } #[test] @@ -3204,7 +3204,7 @@ fn sk_2353() { assert_has_tip(&[], &hed, Lat, &["heqati"]); assert_has_tip(&[], &hed, Lit, &["jiheqa"]); assert_has_tip(&[], &nic(&hed), Lat, &["hiqayati"]); - assert_has_lun_karmani(&[], &hed, &["ahiqi", "ahIqi"]); + assert_has_ta_k(&[], &hed, Lun, &["ahiqi", "ahIqi"]); let hed_anadare = d("heqf~", Bhvadi); assert_has_tip(&[], &nic(&hed_anadare), Lat, &["heqayati"]); @@ -3223,7 +3223,7 @@ fn sk_2353() { let krath = d("kraTa~", Bhvadi); assert_has_tip(&[], &nic(&krath), Lat, &["krATayati"]); - assert_has_lun_karmani(&[], &krath, &["akraTi", "akrATi"]); + assert_has_ta_k(&[], &krath, Lun, &["akraTi", "akrATi"]); assert_has_krdanta(&[], &krath, Krt::Ramul, &["kraTam", "krATam"]); let van = d("vana~", Bhvadi); diff --git a/vidyut-prakriya/tests/kaumudi_46.rs b/vidyut-prakriya/tests/kaumudi_46.rs index 9a357ba..9b0cee1 100644 --- a/vidyut-prakriya/tests/kaumudi_46.rs +++ b/vidyut-prakriya/tests/kaumudi_46.rs @@ -408,7 +408,7 @@ fn sk_2513() { fn sk_2514() { let x = d("Sli\\za~", Divadi); // TODO: samAslikzat - assert_has_lun_karmani(&[], &x, &["aSlezi"]); + assert_has_ta_k(&[], &x, Lun, &["aSlezi"]); assert_has_aataam(&[], &x, Lun, &["aSlikzAtAm"]); assert_has_jha(&[], &x, Lun, &["aSlikzata"]); assert_has_thaas(&[], &x, Lun, &["aSlizWAH"]); @@ -424,10 +424,8 @@ fn sk_2514() { assert_has_ta(&[], &x, Lrt, &["Sakzyate"]); assert_has_tip(&[], &x, Lat, &["aSakat"]); assert_has_tip(&[], &x, Lat, &["aSakta"]); - assert_has_ta(&[], &x, Lit, &["sewko'yamityeke"]); assert_has_tip(&[], &x, Lut, &["SakitA"]); assert_has_tip(&[], &x, Lrt, &["Sakizyati"]); - assert_has_tip(&[], &x, Lat, &["GarmasrutAvityarTaH"]); assert_has_tip(&[], &x, Lat, &["svidyati"]); assert_has_tip(&[], &x, Lat, &["sizveda"]); assert_has_tip(&[], &x, Lat, &["sizvediTa"]); @@ -439,13 +437,10 @@ fn sk_2514() { assert_has_tip(&[], &x, Lat, &["SuDyati"]); assert_has_tip(&[], &x, Lat, &["SuSoDa"]); assert_has_tip(&[], &x, Lut, &["SodDA"]); - assert_has_tip(&[], &x, Lat, &["UditpAWaH"]); - assert_has_tip(&[], &x, Lat, &["prAmAdikaH"]); assert_has_tip(&[], &x, Lat, &["siDyati"]); assert_has_tip(&[], &x, Lut, &["sedDA"]); assert_has_tip(&[], &x, Lrt, &["setsyati"]); assert_has_tip(&[], &x, Lat, &["asiDat"]); - assert_has_tip(&[], &x, Lat, &["saMrIdDirnizpattiH"]); assert_has_tip(&[], &x, Lat, &["raDyati"]); assert_has_tas(&[], &x, Lit, &["raranDatuH"]); } diff --git a/vidyut-prakriya/tests/kaumudi_48.rs b/vidyut-prakriya/tests/kaumudi_48.rs index 6e183eb..b819b89 100644 --- a/vidyut-prakriya/tests/kaumudi_48.rs +++ b/vidyut-prakriya/tests/kaumudi_48.rs @@ -1,7 +1,7 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt as Krt; use vidyut_prakriya::args::Gana::*; -use vidyut_prakriya::args::Krt; use vidyut_prakriya::args::Lakara::*; #[test] diff --git a/vidyut-prakriya/tests/kaumudi_52.rs b/vidyut-prakriya/tests/kaumudi_52.rs index bf68224..623427e 100644 --- a/vidyut-prakriya/tests/kaumudi_52.rs +++ b/vidyut-prakriya/tests/kaumudi_52.rs @@ -67,8 +67,8 @@ fn sk_2574() { // ac-Adi dhatus with can-pratyaya and ak-lopa // TODO: why does the SK have AndaDat and not AndiDat? - assert_has_lun_p(&[], &d("anDa", Curadi), &["AndaDat"]); - assert_has_lun_p(&[], &d("anka", Curadi), &["AYcakat"]); - assert_has_lun_p(&[], &d("anga", Curadi), &["AYjagat"]); - assert_has_lun_p(&[], &d("vyaya", Curadi), &["avavyayat"]); + assert_has_tip(&[], &d("anDa", Curadi), Lun, &["AndaDat"]); + assert_has_tip(&[], &d("anka", Curadi), Lun, &["AYcakat"]); + assert_has_tip(&[], &d("anga", Curadi), Lun, &["AYjagat"]); + assert_has_tip(&[], &d("vyaya", Curadi), Lun, &["avavyayat"]); } diff --git a/vidyut-prakriya/tests/kaumudi_65.rs b/vidyut-prakriya/tests/kaumudi_65.rs index 16fcfdd..bc794f6 100644 --- a/vidyut-prakriya/tests/kaumudi_65.rs +++ b/vidyut-prakriya/tests/kaumudi_65.rs @@ -1,11 +1,11 @@ extern crate test_utils; use test_utils::*; +use vidyut_prakriya::args::BaseKrt; +use vidyut_prakriya::args::BaseKrt::*; use vidyut_prakriya::args::Dhatu; use vidyut_prakriya::args::Gana::*; -use vidyut_prakriya::args::Krt; -use vidyut_prakriya::args::Krt::*; -fn assert_has_krt(prefixes: &[&str], dhatu: &Dhatu, krt: Krt, expected: &[&str]) { +fn assert_has_krt(prefixes: &[&str], dhatu: &Dhatu, krt: BaseKrt, expected: &[&str]) { assert_has_krdanta(prefixes, dhatu, krt, expected) } diff --git a/vidyut-prakriya/tests/kaumudi_67.rs b/vidyut-prakriya/tests/kaumudi_67.rs index ae1403c..dda48eb 100644 --- a/vidyut-prakriya/tests/kaumudi_67.rs +++ b/vidyut-prakriya/tests/kaumudi_67.rs @@ -7,33 +7,39 @@ use vidyut_prakriya::args::*; #[test] fn unadi_1_1() { - assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Krt::uR, &["kAru"]); - assert_has_krdanta(&[], &d("pA\\", Bhvadi), Krt::uR, &["pAyu"]); - assert_has_krdanta(&[], &d("vA\\", Adadi), Krt::uR, &["vAyu"]); - assert_has_krdanta(&[], &d("ji\\", Bhvadi), Krt::uR, &["jAyu"]); - assert_has_krdanta(&[], &d("qumi\\Y", Svadi), Krt::uR, &["mAyu"]); - assert_has_krdanta(&[], &d("zvada~\\", Bhvadi), Krt::uR, &["svAdu"]); - assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Krt::uR, &["sADu"]); - assert_has_krdanta(&[], &d("aSU~\\", Svadi), Krt::uR, &["ASu"]); + assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Unadi::uR, &["kAru"]); + assert_has_krdanta(&[], &d("pA\\", Bhvadi), Unadi::uR, &["pAyu"]); + assert_has_krdanta(&[], &d("vA\\", Adadi), Unadi::uR, &["vAyu"]); + assert_has_krdanta(&[], &d("ji\\", Bhvadi), Unadi::uR, &["jAyu"]); + assert_has_krdanta(&[], &d("qumi\\Y", Svadi), Unadi::uR, &["mAyu"]); + assert_has_krdanta(&[], &d("zvada~\\", Bhvadi), Unadi::uR, &["svAdu"]); + assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Unadi::uR, &["sADu"]); + assert_has_krdanta(&[], &d("aSU~\\", Svadi), Unadi::uR, &["ASu"]); +} + +#[test] +fn unadi_1_2() { + let t = Tester::with_chaandasa(); + t.assert_has_krt(&[], &d("i\\R", Adadi), Unadi::uR, &["Ayu"]); } #[ignore] #[test] fn unadi_1_5() { // TODO: not sure where to apply r --> l - assert_has_krdanta(&[], &d("tF", Bhvadi), Krt::YuR, &["tAlu"]); + assert_has_krdanta(&[], &d("tF", Bhvadi), Unadi::YuR, &["tAlu"]); } #[test] fn unadi_1_45() { - assert_has_krdanta(&[], &d("ava~", Bhvadi), Krt::wizac, &["aviza"]); + assert_has_krdanta(&[], &d("ava~", Bhvadi), Unadi::wizac, &["aviza"]); // TODO: right mah? - assert_has_krdanta(&[], &d("maha~", Bhvadi), Krt::wizac, &["mahiza"]); + assert_has_krdanta(&[], &d("maha~", Bhvadi), Unadi::wizac, &["mahiza"]); } #[test] fn unadi_1_69() { - use Krt::tun; + use Unadi::tun; assert_has_krdanta(&[], &d("zi\\Y", Svadi), tun, &["setu"]); assert_has_krdanta(&[], &d("tanu~^", Tanadi), tun, &["tantu"]); assert_has_krdanta(&[], &d("ga\\mx~", Bhvadi), tun, &["gantu"]); @@ -47,36 +53,36 @@ fn unadi_1_69() { #[test] fn unadi_1_77() { - assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Krt::katu, &["kratu"]); + assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), Unadi::katu, &["kratu"]); } #[test] fn unadi_2_2() { - assert_has_krdanta(&[], &d("ha\\na~", Adadi), Krt::kTan, &["haTa"]); - assert_has_krdanta(&[], &d("kuza~", Kryadi), Krt::kTan, &["kuzWa"]); - assert_has_krdanta(&[], &d("RI\\Y", Tanadi), Krt::kTan, &["nITa"]); - assert_has_krdanta(&[], &d("kASf~", Bhvadi), Krt::kTan, &["kAzWa"]); + assert_has_krdanta(&[], &d("ha\\na~", Adadi), Unadi::kTan, &["haTa"]); + assert_has_krdanta(&[], &d("kuza~", Kryadi), Unadi::kTan, &["kuzWa"]); + assert_has_krdanta(&[], &d("RI\\Y", Tanadi), Unadi::kTan, &["nITa"]); + assert_has_krdanta(&[], &d("kASf~", Bhvadi), Unadi::kTan, &["kAzWa"]); } #[test] fn unadi_2_108() { - assert_has_krdanta(&[], &d("arca~", Bhvadi), Krt::isi, &["arcis"]); - assert_has_krdanta(&[], &d("I~Suci~^r", Divadi), Krt::isi, &["Socis"]); - assert_has_krdanta(&[], &d("hu\\", Juhotyadi), Krt::isi, &["havis"]); - assert_has_krdanta(&[], &d("sf\\px~", Bhvadi), Krt::isi, &["sarpis"]); - assert_has_krdanta(&[], &d("Cada~", Curadi), Krt::isi, &["Cadis"]); - assert_has_krdanta(&[], &d("Carda~", Curadi), Krt::isi, &["Cardis"]); + assert_has_krdanta(&[], &d("arca~", Bhvadi), Unadi::isi, &["arcis"]); + assert_has_krdanta(&[], &d("I~Suci~^r", Divadi), Unadi::isi, &["Socis"]); + assert_has_krdanta(&[], &d("hu\\", Juhotyadi), Unadi::isi, &["havis"]); + assert_has_krdanta(&[], &d("sf\\px~", Bhvadi), Unadi::isi, &["sarpis"]); + assert_has_krdanta(&[], &d("Cada~", Curadi), Unadi::isi, &["Cadis"]); + assert_has_krdanta(&[], &d("Carda~", Curadi), Unadi::isi, &["Cardis"]); // TODO: id-anta? } #[test] fn unadi_2_115() { - assert_has_krdanta(&[], &d("janI~\\", Divadi), Krt::usi, &["janus"]); + assert_has_krdanta(&[], &d("janI~\\", Divadi), Unadi::usi, &["janus"]); } #[test] fn unadi_2_117() { - use Krt::usi; + use Unadi::usi; assert_has_krdanta(&[], &d("f\\", Bhvadi), usi, &["arus"]); assert_has_krdanta(&[], &d("pF", Kryadi), usi, &["parus"]); assert_has_krdanta(&[], &d("quva\\pa~^", Bhvadi), usi, &["vapus"]); @@ -89,39 +95,44 @@ fn unadi_2_117() { #[test] fn unadi_2_118() { - assert_has_krdanta(&[], &d("i\\R", Adadi), Krt::usi, &["Ayus"]); + assert_has_krdanta(&[], &d("i\\R", Adadi), Unadi::usi, &["Ayus"]); // TODO: AyuzI } #[test] fn unadi_2_119() { - assert_has_krdanta(&[], &d("ca\\kzi~\\N", Adadi), Krt::usi, &["cakzus"]); + assert_has_krdanta(&[], &d("ca\\kzi~\\N", Adadi), Unadi::usi, &["cakzus"]); } #[test] fn unadi_2_120() { - assert_has_krdanta(&[], &d("mu\\ha~", Divadi), Krt::usi, &["muhus"]); + assert_has_krdanta(&[], &d("mu\\ha~", Divadi), Unadi::usi, &["muhus"]); } #[ignore] #[test] fn unadi_3_29() { - assert_has_krdanta(&[], &d("stana", Curadi), Krt::itnuc, &["stanayitnu"]); - assert_has_krdanta(&[], &nic(&d("hfza~", Divadi)), Krt::itnuc, &["harzayitnu"]); + assert_has_krdanta(&[], &d("stana", Curadi), Unadi::itnuc, &["stanayitnu"]); + assert_has_krdanta( + &[], + &nic(&d("hfza~", Divadi)), + Unadi::itnuc, + &["harzayitnu"], + ); // TODO: popayitnu? - assert_has_krdanta(&[], &d("gada", Curadi), Krt::itnuc, &["gadayitnu"]); - assert_has_krdanta(&[], &d("mada~", Curadi), Krt::itnuc, &["madayitnu"]); + assert_has_krdanta(&[], &d("gada", Curadi), Unadi::itnuc, &["gadayitnu"]); + assert_has_krdanta(&[], &d("mada~", Curadi), Unadi::itnuc, &["madayitnu"]); } #[test] fn unadi_3_43() { - assert_has_krdanta(&[], &d("i\\R", Adadi), Krt::kan, &["eka"]); - assert_has_krdanta(&[], &d("YiBI\\", Juhotyadi), Krt::kan, &["Beka"]); - assert_has_krdanta(&[], &d("kE\\", Tanadi), Krt::kan, &["kAka"]); - assert_has_krdanta(&[], &d("pA\\", Adadi), Krt::kan, &["pAka"]); - assert_has_krdanta(&[], &d("Sala~", Bhvadi), Krt::kan, &["Salka"]); - assert_has_krdanta(&[], &d("ata~", Bhvadi), Krt::kan, &["atka"]); - assert_has_krdanta(&[], &d("marca~", Bhvadi), Krt::kan, &["marka", "markka"]); + assert_has_krdanta(&[], &d("i\\R", Adadi), Unadi::kan, &["eka"]); + assert_has_krdanta(&[], &d("YiBI\\", Juhotyadi), Unadi::kan, &["Beka"]); + assert_has_krdanta(&[], &d("kE\\", Tanadi), Unadi::kan, &["kAka"]); + assert_has_krdanta(&[], &d("pA\\", Adadi), Unadi::kan, &["pAka"]); + assert_has_krdanta(&[], &d("Sala~", Bhvadi), Unadi::kan, &["Salka"]); + assert_has_krdanta(&[], &d("ata~", Bhvadi), Unadi::kan, &["atka"]); + assert_has_krdanta(&[], &d("marca~", Bhvadi), Unadi::kan, &["marka", "markka"]); } #[test] @@ -129,151 +140,161 @@ fn unadi_3_62() { // TODO: why not varza and tarza? // assert_has_krdanta(&[], &d("vF", Kryadi), Krt::sa, &["varsa"]); // assert_has_krdanta(&[], &d("tF", Bhvadi), Krt::sa, &["tarsa"]); - assert_has_krdanta(&[], &d("vada~", Bhvadi), Krt::sa, &["vatsa"]); - assert_has_krdanta(&[], &d("ha\\na~", Adadi), Krt::sa, &["haMsa"]); - assert_has_krdanta(&[], &d("kamu~\\", Bhvadi), Krt::sa, &["kaMsa"]); - assert_has_krdanta(&[], &d("kaza~", Bhvadi), Krt::sa, &["kakza"]); + assert_has_krdanta(&[], &d("vada~", Bhvadi), Unadi::sa, &["vatsa"]); + assert_has_krdanta(&[], &d("ha\\na~", Adadi), Unadi::sa, &["haMsa"]); + assert_has_krdanta(&[], &d("kamu~\\", Bhvadi), Unadi::sa, &["kaMsa"]); + assert_has_krdanta(&[], &d("kaza~", Bhvadi), Unadi::sa, &["kakza"]); } #[test] fn unadi_3_70() { - assert_has_krdanta(&[], &d("aSU~\\", Svadi), Krt::sara, &["akzara"]); + assert_has_krdanta(&[], &d("aSU~\\", Svadi), Unadi::sara, &["akzara"]); } #[test] fn unadi_3_86() { - assert_has_krdanta(&[], &d("hase~", Bhvadi), Krt::tan, &["hasta"]); - assert_has_krdanta(&[], &d("mf\\N", Tanadi), Krt::tan, &["marta"]); - assert_has_krdanta(&[], &d("gF", Tudadi), Krt::tan, &["garta"]); - assert_has_krdanta(&[], &d("i\\R", Adadi), Krt::tan, &["eta"]); - assert_has_krdanta(&[], &d("vA\\", Adadi), Krt::tan, &["vAta"]); - assert_has_krdanta(&[], &d("ama~", Bhvadi), Krt::tan, &["anta"]); - assert_has_krdanta(&[], &d("damu~", Divadi), Krt::tan, &["danta"]); - assert_has_krdanta(&[], &d("lUY", Kryadi), Krt::tan, &["lota"]); - assert_has_krdanta(&[], &d("pUY", Kryadi), Krt::tan, &["pota"]); + assert_has_krdanta(&[], &d("hase~", Bhvadi), Unadi::tan, &["hasta"]); + assert_has_krdanta(&[], &d("mf\\N", Tanadi), Unadi::tan, &["marta"]); + assert_has_krdanta(&[], &d("gF", Tudadi), Unadi::tan, &["garta"]); + assert_has_krdanta(&[], &d("i\\R", Adadi), Unadi::tan, &["eta"]); + assert_has_krdanta(&[], &d("vA\\", Adadi), Unadi::tan, &["vAta"]); + assert_has_krdanta(&[], &d("ama~", Bhvadi), Unadi::tan, &["anta"]); + assert_has_krdanta(&[], &d("damu~", Divadi), Unadi::tan, &["danta"]); + assert_has_krdanta(&[], &d("lUY", Kryadi), Unadi::tan, &["lota"]); + assert_has_krdanta(&[], &d("pUY", Kryadi), Unadi::tan, &["pota"]); // TODO: enable this after fixing cchvoh // assert_has_krdanta(&[], &d("DurvI~", Bhvadi), Krt::tan, &["DUrta"]); } #[test] fn unadi_3_96() { - assert_has_krdanta(&[], &d("Sru\\", Bhvadi), Krt::Ayya, &["SravAyya"]); - assert_has_krdanta(&[], &d("dakza~\\", Bhvadi), Krt::Ayya, &["dakzAyya"]); - assert_has_krdanta(&[], &d("spfha", Curadi), Krt::Ayya, &["spfhayAyya"]); - assert_has_krdanta(&[], &d("gfha", Curadi), Krt::Ayya, &["gfhayAyya"]); + assert_has_krdanta(&[], &d("Sru\\", Bhvadi), Unadi::Ayya, &["SravAyya"]); + assert_has_krdanta(&[], &d("dakza~\\", Bhvadi), Unadi::Ayya, &["dakzAyya"]); + assert_has_krdanta(&[], &d("spfha", Curadi), Unadi::Ayya, &["spfhayAyya"]); + assert_has_krdanta(&[], &d("gfha", Curadi), Unadi::Ayya, &["gfhayAyya"]); } #[test] fn unadi_3_126() { - assert_has_krdanta(&[], &d("jF", Kryadi), Krt::Jac, &["jaranta"]); - assert_has_krdanta(&[], &d("vi\\Sa~", Tudadi), Krt::Jac, &["veSanta"]); + assert_has_krdanta(&[], &d("jF", Kryadi), Unadi::Jac, &["jaranta"]); + assert_has_krdanta(&[], &d("vi\\Sa~", Tudadi), Unadi::Jac, &["veSanta"]); } #[test] fn unadi_3_127() { - assert_has_krdanta(&[], &d("ru\\ha~", Bhvadi), Krt::Jac, &["rohanta"]); - assert_has_krdanta(&[], &d("wunadi~", Bhvadi), Krt::Jac, &["nandanta"]); - assert_has_krdanta(&[], &d("jIva~", Tudadi), Krt::Jac, &["jIvanta"]); + assert_has_krdanta(&[], &d("ru\\ha~", Bhvadi), Unadi::Jac, &["rohanta"]); + assert_has_krdanta(&[], &d("wunadi~", Bhvadi), Unadi::Jac, &["nandanta"]); + assert_has_krdanta(&[], &d("jIva~", Tudadi), Unadi::Jac, &["jIvanta"]); // TODO: zit } #[test] fn unadi_3_128() { - assert_has_krdanta(&[], &d("tF", Bhvadi), Krt::Jac, &["taranta"]); - assert_has_krdanta(&[], &d("BU", Bhvadi), Krt::Jac, &["Bavanta"]); - assert_has_krdanta(&[], &d("va\\ha~^", Bhvadi), Krt::Jac, &["vahanta"]); - assert_has_krdanta(&[], &d("va\\sa~", Bhvadi), Krt::Jac, &["vasanta"]); - assert_has_krdanta(&[], &d("BAsf~\\", Bhvadi), Krt::Jac, &["BAsanta"]); - assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Krt::Jac, &["sADanta"]); - assert_has_krdanta(&[], &nic(&d("gaqi~", Bhvadi)), Krt::Jac, &["gaRqayanta"]); - assert_has_krdanta(&[], &nic(&d("maqi~\\", Tudadi)), Krt::Jac, &["maRqayanta"]); - assert_has_krdanta(&[], &d("ji\\", Bhvadi), Krt::Jac, &["jayanta"]); + assert_has_krdanta(&[], &d("tF", Bhvadi), Unadi::Jac, &["taranta"]); + assert_has_krdanta(&[], &d("BU", Bhvadi), Unadi::Jac, &["Bavanta"]); + assert_has_krdanta(&[], &d("va\\ha~^", Bhvadi), Unadi::Jac, &["vahanta"]); + assert_has_krdanta(&[], &d("va\\sa~", Bhvadi), Unadi::Jac, &["vasanta"]); + assert_has_krdanta(&[], &d("BAsf~\\", Bhvadi), Unadi::Jac, &["BAsanta"]); + assert_has_krdanta(&[], &d("sA\\Da~", Svadi), Unadi::Jac, &["sADanta"]); + assert_has_krdanta(&[], &nic(&d("gaqi~", Bhvadi)), Unadi::Jac, &["gaRqayanta"]); + assert_has_krdanta( + &[], + &nic(&d("maqi~\\", Tudadi)), + Unadi::Jac, + &["maRqayanta"], + ); + assert_has_krdanta(&[], &d("ji\\", Bhvadi), Unadi::Jac, &["jayanta"]); // nandayanta? } #[test] fn unadi_3_155() { - assert_has_krdanta(&[], &d("pluza~", Kryadi), Krt::ksi, &["plukzi"]); - assert_has_krdanta(&[], &d("kuza~", Kryadi), Krt::ksi, &["kukzi"]); - assert_has_krdanta(&[], &d("Su\\za~", Divadi), Krt::ksi, &["Sukzi"]); + assert_has_krdanta(&[], &d("pluza~", Kryadi), Unadi::ksi, &["plukzi"]); + assert_has_krdanta(&[], &d("kuza~", Kryadi), Unadi::ksi, &["kukzi"]); + assert_has_krdanta(&[], &d("Su\\za~", Divadi), Unadi::ksi, &["Sukzi"]); } #[test] fn unadi_3_156() { - assert_has_krdanta(&[], &d("aSU~", Svadi), Krt::ksi, &["akzi"]); + assert_has_krdanta(&[], &d("aSU~", Svadi), Unadi::ksi, &["akzi"]); } #[test] fn unadi_3_157() { - assert_has_krdanta(&[], &d("izu~", Tudadi), Krt::ksu, &["ikzu"]); + assert_has_krdanta(&[], &d("izu~", Tudadi), Unadi::ksu, &["ikzu"]); } #[test] fn unadi_4_2() { - assert_has_krdanta(&[], &d("f\\", Juhotyadi), Krt::katnic, &["ratni"]); - assert_has_krdanta(&[], &d("tanu~^", Tanadi), Krt::yatuc, &["tanyatu"]); - assert_has_krdanta(&[], &d("anjU~", Rudhadi), Krt::alic, &["aYjali"]); - assert_has_krdanta(&[], &d("vana~", Bhvadi), Krt::izWuc, &["vanizWu"]); - assert_has_krdanta(&[], &d("anjU~", Rudhadi), Krt::izWac, &["aYjizWa"]); - assert_has_krdanta(&[], &nic(&d("f\\", Juhotyadi)), Krt::isan, &["arpisa"]); + assert_has_krdanta(&[], &d("f\\", Juhotyadi), Unadi::katnic, &["ratni"]); + assert_has_krdanta(&[], &d("tanu~^", Tanadi), Unadi::yatuc, &["tanyatu"]); + assert_has_krdanta(&[], &d("anjU~", Rudhadi), Unadi::alic, &["aYjali"]); + assert_has_krdanta(&[], &d("vana~", Bhvadi), Unadi::izWuc, &["vanizWu"]); + assert_has_krdanta(&[], &d("anjU~", Rudhadi), Unadi::izWac, &["aYjizWa"]); + assert_has_krdanta(&[], &nic(&d("f\\", Juhotyadi)), Unadi::isan, &["arpisa"]); // TODO: why is this aniw? // assert_has_krdanta(&[], &d("madI~", Divadi), Krt::syan, &["matsya"]); - assert_has_krdanta(&[], &d("ata~", Bhvadi), Krt::iTin, &["atiTi"]); - assert_has_krdanta(&[], &d("anga", Curadi), Krt::uli, &["aNguli"]); - assert_has_krdanta(&[], &d("ku\\", Adadi), Krt::asa, &["kavasa"]); - assert_has_krdanta(&[], &d("yu", Adadi), Krt::Asa, &["yavAsa"]); - assert_has_krdanta(&[], &d("kfSa~", Divadi), Krt::Anuk, &["kfSAnu"]); + assert_has_krdanta(&[], &d("ata~", Bhvadi), Unadi::iTin, &["atiTi"]); + assert_has_krdanta(&[], &d("anga", Curadi), Unadi::uli, &["aNguli"]); + assert_has_krdanta(&[], &d("ku\\", Adadi), Unadi::asa, &["kavasa"]); + assert_has_krdanta(&[], &d("yu", Adadi), Unadi::Asa, &["yavAsa"]); + assert_has_krdanta(&[], &d("kfSa~", Divadi), Unadi::Anuk, &["kfSAnu"]); } #[test] fn unadi_4_6() { - assert_has_krdanta(&[], &d("ga\\mx~", Bhvadi), Krt::ini, &["gamin"]); + assert_has_krdanta(&[], &d("ga\\mx~", Bhvadi), Unadi::ini, &["gamin"]); } #[test] fn unadi_4_7() { - assert_has_krdanta(&["AN"], &d("ga\\mx~", Bhvadi), Krt::ini, &["AgAmin"]); + assert_has_krdanta(&["AN"], &d("ga\\mx~", Bhvadi), Unadi::ini, &["AgAmin"]); } #[test] fn unadi_4_8() { - assert_has_krdanta(&[], &d("BU", Bhvadi), Krt::ini, &["BAvin"]); + assert_has_krdanta(&[], &d("BU", Bhvadi), Unadi::ini, &["BAvin"]); } #[test] fn unadi_4_9() { - assert_has_krdanta(&["pra"], &d("zWA\\", Bhvadi), Krt::ini, &["prasTAyin"]); + assert_has_krdanta(&["pra"], &d("zWA\\", Bhvadi), Unadi::ini, &["prasTAyin"]); } #[ignore] #[test] fn unadi_4_10() { - assert_has_krdanta(&["parama"], &d("zWA\\", Bhvadi), Krt::ini, &["paramezWin"]); + assert_has_krdanta( + &["parama"], + &d("zWA\\", Bhvadi), + Unadi::ini, + &["paramezWin"], + ); } #[ignore] #[test] fn unadi_4_11() { - assert_has_krdanta(&[], &d("maTi~", Bhvadi), Krt::ini, &["maTin"]); + assert_has_krdanta(&[], &d("maTi~", Bhvadi), Unadi::ini, &["maTin"]); } #[test] fn unadi_4_12() { - assert_has_krdanta(&[], &d("patx~", Bhvadi), Krt::ini, &["paTin"]); + assert_has_krdanta(&[], &d("patx~", Bhvadi), Unadi::ini, &["paTin"]); } #[test] fn unadi_4_54() { - assert_has_krdanta(&[], &d("jF", Kryadi), Krt::kvinUnadi, &["jIrvi"]); - assert_has_krdanta(&[], &d("SFY", Kryadi), Krt::kvinUnadi, &["SIrvi"]); - assert_has_krdanta(&[], &d("stFY", Kryadi), Krt::kvinUnadi, &["stIrvi"]); - assert_has_krdanta(&[], &d("jAgf", Adadi), Krt::kvinUnadi, &["jAgfvi"]); + assert_has_krdanta(&[], &d("jF", Kryadi), Unadi::kvin, &["jIrvi"]); + assert_has_krdanta(&[], &d("SFY", Kryadi), Unadi::kvin, &["SIrvi"]); + assert_has_krdanta(&[], &d("stFY", Kryadi), Unadi::kvin, &["stIrvi"]); + assert_has_krdanta(&[], &d("jAgf", Adadi), Unadi::kvin, &["jAgfvi"]); } #[ignore] #[test] fn unadi_4_117() { - use Krt::in_; + use Unadi::in_; assert_has_krdanta(&[], &d("qupa\\ca~^z", Bhvadi), in_, &["paci"]); assert_has_krdanta(&[], &d("tuqa~", Tudadi), in_, &["tuqi"]); assert_has_krdanta(&[], &d("tuqi~\\", Bhvadi), in_, &["tuRqi"]); @@ -295,7 +316,7 @@ fn unadi_4_117() { #[test] fn unadi_4_144() { - use Krt::manin; + use Unadi::manin; assert_has_krdanta(&[], &d("qukf\\Y", Tanadi), manin, &["karman"]); assert_has_krdanta(&[], &d("cara~", Bhvadi), manin, &["carman"]); assert_has_krdanta(&[], &d("Basa~", Juhotyadi), manin, &["Basman"]); @@ -307,14 +328,14 @@ fn unadi_4_144() { #[test] fn unadi_4_158() { - assert_has_krdanta(&[], &d("vasa~\\", Adadi), Krt::zwran, &["vastra"]); - assert_has_krdanta(&[], &d("asu~", Divadi), Krt::zwran, &["astra"]); - assert_has_krdanta(&[], &d("Sasu~", Bhvadi), Krt::zwran, &["Sastra"]); + assert_has_krdanta(&[], &d("vasa~\\", Adadi), Unadi::zwran, &["vastra"]); + assert_has_krdanta(&[], &d("asu~", Divadi), Unadi::zwran, &["astra"]); + assert_has_krdanta(&[], &d("Sasu~", Bhvadi), Unadi::zwran, &["Sastra"]); } #[test] fn unadi_4_188() { - use Krt::asun; + use Unadi::asun; assert_has_krdanta(&[], &d("citI~", Bhvadi), asun, &["cetas"]); assert_has_krdanta(&[], &d("sf\\", Bhvadi), asun, &["saras"]); assert_has_krdanta(&[], &d("pI\\N", Divadi), asun, &["payas"]); @@ -323,20 +344,20 @@ fn unadi_4_188() { #[test] fn unadi_4_189() { - assert_has_krdanta(&[], &d("rapa~", Bhvadi), Krt::asun, &["repas"]); + assert_has_krdanta(&[], &d("rapa~", Bhvadi), Unadi::asun, &["repas"]); } #[test] fn unadi_5_68() { - assert_has_krdanta(&[], &d("praTa~\\", Bhvadi), Krt::amac, &["praTama"]); + assert_has_krdanta(&[], &d("praTa~\\", Bhvadi), Unadi::amac, &["praTama"]); } #[test] fn unadi_5_69() { - assert_has_krdanta(&[], &d("cara~", Bhvadi), Krt::amac, &["carama"]); + assert_has_krdanta(&[], &d("cara~", Bhvadi), Unadi::amac, &["carama"]); } #[test] fn unadi_5_70() { - assert_has_krdanta(&[], &d("magi~", Bhvadi), Krt::alac, &["maNgala"]); + assert_has_krdanta(&[], &d("magi~", Bhvadi), Unadi::alac, &["maNgala"]); }