Skip to content

Commit 860e0f1

Browse files
committed
Nuevo test
1 parent 60fda08 commit 860e0f1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

dfa_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,33 @@ func Test6DFAMinimo(t *testing.T) {
252252
t.Errorf("error, minimized automata should have the same number of states, got %d", Min.States.Size())
253253
}
254254

255+
}
256+
257+
func Test7DFAMinimo(t *testing.T) {
258+
// L = fee | fie
259+
var states []State
260+
A := 0
261+
B := 1
262+
C := 2
263+
D := 3
264+
E := 4
265+
F := 5
266+
states = append(states, A, B, C, D, E, F)
267+
fs := []State{ D, F }
268+
alphabet := []int{1, 2, 3}
269+
delta := make(map[State]map[int]State)
270+
delta[A] = map[int]State{1: B}
271+
delta[B] = map[int]State{2: C}
272+
delta[B] = map[int]State{3: E}
273+
delta[C] = map[int]State{2: D}
274+
delta[E] = map[int]State{2: F}
275+
276+
M := DFA{States: states, InitialState: A, FinalStates: fs, Delta: delta, Alphabet: alphabet}
277+
278+
Min := HopcroftDFAMin(M)
279+
280+
if Min.States.Size() != 4 {
281+
t.Errorf("error, minimized automata should have less states, got %d expected 4", Min.States.Size())
282+
}
283+
255284
}

0 commit comments

Comments
 (0)