27 lines
No EOL
656 B
FSharp
27 lines
No EOL
656 B
FSharp
module Tests
|
|
|
|
open System
|
|
open DFA
|
|
|
|
let numericDFA:DFA = {
|
|
sigma = Seq.toList "01ab";
|
|
states = [
|
|
{name = "yes"};
|
|
{name = "no"}
|
|
];
|
|
delta = (fun x y ->
|
|
match (x, y) with
|
|
| ({name = "yes"}, '0') -> {name = "yes"}
|
|
| ({name = "yes"}, '1') -> {name = "yes"}
|
|
| _ -> {name = "no"}
|
|
);
|
|
beginState = {name = "yes"};
|
|
acceptingStates = [{name = "yes"}]
|
|
}
|
|
|
|
let test =
|
|
printfn "Testing numeric checker DFA"
|
|
printfn "Is valid DFA: %b" (DFA.validateDFA numericDFA)
|
|
printfn "0101: %b" (DFA.acceptsWord numericDFA "0101")
|
|
printfn "01a1: %b" (DFA.acceptsWord numericDFA "01a1")
|
|
0 |