--- a/compiler/tests/PEGFsaStateTest.st Fri Jul 24 15:06:54 2015 +0100
+++ b/compiler/tests/PEGFsaStateTest.st Mon Aug 17 12:13:16 2015 +0100
@@ -15,10 +15,10 @@
state := PEGFsaState new name: #state; retval: #state; yourself.
anotherState := PEGFsaState new name: #anotherState; retval: #anotherState; yourself.
- t1 := PEGFsaTransition new.
- t2 := PEGFsaTransition new.
- t3 := PEGFsaTransition new.
- t4 := PEGFsaTransition new.
+ t1 := PEGFsaCharacterTransition new.
+ t2 := PEGFsaCharacterTransition new.
+ t3 := PEGFsaCharacterTransition new.
+ t4 := PEGFsaCharacterTransition new.
!
@@ -73,127 +73,43 @@
!
-testEquals
- state addTransition: t1.
- anotherState addTransition: t2.
-
- state retval: #baz.
- anotherState retval: #baz.
+testCopy4
+ anotherState := state copy.
- t1 destination: #foo.
- t2 destination: #bar.
-
- self assert: (state equals: anotherState) not
-!
-
-testEquals2
- state addTransition: t1.
- anotherState addTransition: t2.
-
- state retval: #baz.
- anotherState retval: #baz.
+ self assert: (state = anotherState).
+ self assert: (state == anotherState) not.
- t1 destination: #foo.
- t2 destination: #foo.
-
- self assert: (state equals: anotherState).
-!
+ state priority: -1.
+ self assert: (state = anotherState) not.
-testEquals3
- state addTransition: t1.
- anotherState addTransition: t2.
-
- state retval: #bar.
- anotherState retval: #baz.
+ anotherState priority: -1.
+ self assert: (state = anotherState).
- t1 destination: #foo.
- t2 destination: #foo.
-
- self assert: (state equals: anotherState) not
-!
+ anotherState final: true.
+ self assert: (state = anotherState) not.
-testEquals4
- state addTransition: t1.
- anotherState addTransition: t2.
-
- state retval: #bar.
- anotherState retval: #bar.
+ state final: true.
+ self assert: (state = anotherState).
- state priority: 0.
- anotherState priority: -1.
-
- t1 destination: #foo.
- t2 destination: #foo.
-
- self assert: (state equals: anotherState) not
!
-testEquals5
- state addTransition: t1.
- state addTransition: t2.
- anotherState addTransition: t2.
- anotherState addTransition: t3.
-
- state retval: #bar.
- anotherState retval: #bar.
-
- state priority: -1.
- anotherState priority: -1.
+testCopy5
- t1 destination: #foobar.
- t2 destination: #foo.
- t3 destination: #foobar.
-
- self assert: (state equals: anotherState)
-!
-
-testEquals6
- state addTransition: t1.
- state addTransition: t2.
- anotherState addTransition: t1.
-
- state retval: #bar.
- anotherState retval: #bar.
-
- state priority: -1.
- anotherState priority: -1.
- t1 destination: #foo.
- t2 destination: #bar.
-
- self assert: (state equals: anotherState) not
-!
+ state retval: #foo.
+ state failure: true.
+ state final: true.
+ anotherState := state copy.
-testJoin
- | newState |
- state addTransition: t1.
- anotherState addTransition: t2.
- state final: true.
-
- t1 destination: #t1.
- t2 destination: #t2.
-
- newState := state join: anotherState.
+ self assert: (state = anotherState).
+ self assert: (state == anotherState) not.
+
+ anotherState retval: #bar.
+ self assert: state retval == #foo.
+ self assert: state isFsaFailure.
+ self assert: anotherState retval == #bar.
+ self assert: anotherState isFsaFailure.
- self assert: (newState transitions contains: [ :t | t = t1 ]).
- self assert: (newState transitions contains: [ :t | t = t2 ]).
- self assert: (newState isFinal).
-!
-
-testJoin2
- | newState |
- state addTransition: t1.
- anotherState addTransition: t2.
- state final: true.
-
- t1 destination: #t1.
- t2 destination: #t2.
-
- newState := anotherState join: state.
-
- self assert: (newState transitions contains: [ :t | t = t1 ]).
- self assert: (newState transitions contains: [ :t | t = t2 ]).
- self assert: (newState isFinal).
!
testTransitionPairs