%% mitzvot_test.pl — Tests for the specification layer. :- use_module(library(plunit)). :- use_module('../src/specification/mitzvot'). :- use_module('../src/specification/torah_text'). :- use_module('../src/specification/root_meanings'). :- use_module('../src/specification/relationships'). :- begin_tests(mitzvot). %% The specification has mitzvot test(mitzvot_exist) :- total_encoded(Count), Count > 0. %% The three categories exist test(positive_mitzvot_exist) :- mitzvah(_, positive, _, _). test(prohibition_mitzvot_exist) :- mitzvah(_, prohibition, _, _). test(belief_mitzvot_exist) :- mitzvah(_, belief, _, _). %% The first mitzvah is know_hashem test(first_mitzvah) :- mitzvah(1, belief, know_hashem, always). %% Shabbat mitzvot exist test(shabbat_rest) :- mitzvah(154, positive, rest_on_shabbat, when(seventh_day)). test(shabbat_no_work) :- mitzvah(155, prohibition, not_work_on_shabbat, when(seventh_day)). %% The three halt conditions have their mitzvot test(no_other_gods) :- mitzvah(2, prohibition, no_other_gods, always). test(no_murder) :- mitzvah(289, prohibition, not_murder, always). test(no_adultery) :- mitzvah(330, prohibition, not_commit_adultery, always). %% Source references exist test(mitzvah_sources_exist) :- mitzvah_source(1, ref(shemot, 20, 2)). test(shabbat_source) :- mitzvah_source(154, ref(shemot, 20, 8)). :- end_tests(mitzvot). :- begin_tests(torah_text). %% Bereishit 1:1 exists test(bereishit_1_1) :- verse(bereishit, 1, 1, Roots, _), member(bet_resh_aleph, Roots). %% Shema exists test(shema) :- verse(devarim, 6, 4, Roots, _), member(shin_mem_ayin, Roots). %% Verses mentioning a root can be found test(verses_with_bara, [nondet]) :- verses_mentioning_root(bet_resh_aleph, Verses), Verses \= []. :- end_tests(torah_text). :- begin_tests(root_meanings). %% Root meanings exist test(bara_meaning) :- root_meaning(bet_resh_aleph, qal, 'create'). %% Multiple binyanim for a root test(kadash_binyanim) :- findall(B, root_meaning(qof_dalet_shin, B, _), Binyanim), length(Binyanim, Count), Count >= 4. %% Semantic domains test(bara_domain) :- root_domain(bet_resh_aleph, creation). test(kadash_domain) :- root_domain(qof_dalet_shin, holiness). %% Gematria test(bara_gematria) :- root_gematria(bet_resh_aleph, 203). test(kadash_gematria) :- root_gematria(qof_dalet_shin, 404). :- end_tests(root_meanings). :- begin_tests(relationships). %% Tensions exist test(justice_mercy_tension) :- mitzvah_conflicts_with(179, 295, _). %% Complementary mitzvot test(complementary) :- complementary_mitzvot(1, 3). %% Root consonant sharing test(consonant_sharing) :- root_shares_consonants(bet_resh_aleph, bet_resh_kaf, [1, 2]). :- end_tests(relationships).