Project 4
Public Test Cases
Return to project description
#use "nfa.ml";;
(* test for NFA that accepts empty set *)
let m = Nfa.make_nfa 0 [1] [];;
let r1 = Nfa.step m [0] 'a';;
(* r1 should be [] *)
(* test for NFA that accepts empty set *)
let m = Nfa.make_nfa 0 [0] [];;
let r2 = Nfa.accept m "";;
let r3 = Nfa.accept m "a";;
(* r2 should be true *)
(* r3 should be false *)
(* test regular expression of empty string *)
let r = Nfa.Empty_String;;
let m = Nfa.nfa_of_regexp r;;
let r4 = Nfa.accept m "";;
(* r4 should be true *)
(* test for Empty string *)
let r = Nfa.regexp_of_string "E";;
let m = Nfa.nfa_of_regexp r;;
let r5 = Nfa.accept m "E";;
let r6 = Nfa.accept m "ab";;
let r7 = Nfa.accept m "abc";;
let r8 = Nfa.accept m "";;
let r9 = Nfa.accept m "aa";;
let r10 = Nfa.accept m "d";;
(* r5 should be false *)
(* r6 should be false *)
(* r7 should be false *)
(* r8 should be true *)
(* r9 should be false *)
(* r10 should be false *)
|