def test_dfa(): dfsa = deterministic_finite_state_automaton("test"); desc1 = DFADSC.form_desc1(); err_desc1 = DFADSC.form_err_desc1(); err_desc2 = DFADSC.form_err_desc2(); dfsa.unset_notification(); dfsa.import_desc(err_desc2); dfsa.check_desc_isDFA(); #print dfsa.symbol_sets(4); dfsa.check_desc_DFA_nontrivial(); dfsa.show_log();
def test2(): desc1 = DFADSC.form_desc1(); desc2 = DFADSC.form_desc2(); err_desc1 = DFADSC.form_err_desc1(); err_desc2 = DFADSC.form_err_desc2(); dfsa_1 = deterministic_finite_state_automaton("test1"); dfsa_1.unset_notification(); dfsa_1.import_desc(desc1); dfsa_1.check_desc_isDFA(); dfsa_1.check_desc_DFA_nontrivial(); dfsa_2 = deterministic_finite_state_automaton("test2"); dfsa_2.unset_notification(); dfsa_2.import_desc(desc2); dfsa_2.check_desc_isDFA(); dfsa_2.check_desc_DFA_nontrivial(); return (dfsa_1, dfsa_2);
def main(student_id, whether_continuous, continuous_type, \ solutions_dir, tests_dir, randomization): runtestx = run_test(student_id); runtestx.initialize_dfa_verif( \ student_id, solutions_dir, tests_dir); runtestx.change_verif_type(whether_continuous, continuous_type); if (randomization): runtestx.parameterize_randgen(20, 0, 10, 1.0); runtestx.initialize_testing(randomization); runtestx.specify_bench_names(); if (student_id == "course_staff"): desc1 = DFADSC.form_desc1(); desc2 = DFADSC.form_desc2(); err_desc1 = DFADSC.form_err_desc1(); err_desc2 = DFADSC.form_err_desc2(); new_dsc_tbl = {"DFA001":desc1, "DFA1010":desc2, \ "DFA0101":err_desc1, "DFA0011":err_desc2}; runtestx.import_curr_test_dsctable(new_dsc_tbl); runtestx.specify_bench_names(); runtestx.execute_tests(); return runtestx;
def test_run(): newrt = run_test("course_staff"); newrt.initialize_dfa_verif( "dfaver1", "./test_cases/"); newrt.initialize_testing(0); desc1 = DFADSC.form_desc1(); err_desc1 = DFADSC.form_err_desc1(); err_desc2 = DFADSC.form_err_desc2(); newrt.sample_descriptions(); newrt.specify_bench_name('sandy bridge'); newrt.specify_bench_names(); #newrt.test1_verification(); #newrt.test2_verification(); newrt.import_curr_test_dsc(desc1); newrt.specify_bench_name('ivy bridge'); newrt.execute_one(); print '-|'*36; new_dsc_tbl = {"sandy bridge":err_desc1, "ivy bridge":err_desc2}; newrt.import_curr_test_dsctable(new_dsc_tbl); newrt.specify_bench_names(); newrt.execute_tests();
def sample_descriptions(self): self.desc1 = DFADSC.form_desc1(); self.err_desc1 = DFADSC.form_err_desc1(); self.err_desc2 = DFADSC.form_err_desc2();