diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-12-01 20:11:43 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-12-01 20:11:43 (GMT) |
commit | 2c8fe66c0f7490c8aaaae27b4977b987001c6b71 (patch) | |
tree | 32d4ce390d853fb5a8405e71cfb37b6b52988e3b /tests/linear_creatortests.py | |
parent | b7586af9d127e7954674d13ea185a0e84d197c37 (diff) | |
parent | 50ec9ae6ebc7ecc088b5e0a6b79688a717271955 (diff) |
Merge branch 'master' of git://git.sugarlabs.org/tutorius/simpoirs-clone
Conflicts:
src/extensions/tutoriusremote.py
tutorius/TProbe.py
tutorius/creator.py
Diffstat (limited to 'tests/linear_creatortests.py')
-rw-r--r-- | tests/linear_creatortests.py | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/tests/linear_creatortests.py b/tests/linear_creatortests.py deleted file mode 100644 index e3c30c1..0000000 --- a/tests/linear_creatortests.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (C) 2009, Tutorius.org -# Greatly influenced by sugar/activity/namingalert.py -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from sugar.tutorius.core import * -from sugar.tutorius.actions import * -from sugar.tutorius.filters import * -from sugar.tutorius.linear_creator import * -from sugar.tutorius.addons.triggereventfilter import * -from actiontests import CountAction -import unittest - -class CreatorTests(unittest.TestCase): - - def test_simple_usage(self): - creator = LinearCreator() - fsm_name = "SimpleUsageTest" - - creator.set_name(fsm_name) - - # Generate an FSM using the steps - creator.action(CountAction()) - creator.action(CountAction()) - - creator.event(TriggerEventFilter()) - - creator.action(CountAction()) - - creator.event(TriggerEventFilter()) - - fsm = creator.generate_fsm() - - # Make sure everything worked! - assert fsm.name == fsm_name, "Name was not set properly" - - init_state = fsm.get_state_by_name("INIT") - - assert len(init_state.get_action_list()) == 2, "Creator did not insert all the actions" - - assert init_state.get_event_filter_list()[0][1] == "State 1" , "expected next state to be 'State 1' but got %s" % init_state.get_event_filter_list()[0][1] - - state1 = fsm.get_state_by_name("State 1") - - assert len(state1.get_action_list()) == 1, "Creator did not insert all the actions" - - assert state1.get_event_filter_list()[0][1] == "State 2" - - # Make sure we have the final state and that it's empty - state2 = fsm.get_state_by_name("State2") - - assert len(state2.get_action_list()) == 0, "Creator inserted extra actions on wrong state" - - assert len(state2.get_event_filter_list()) == 0, "Creator assigner events to the final state" - - creator.action(CountAction()) - - fsm = creator.generate_fsm() - - state2 = fsm.get_state_by_name("State2") - - assert len(state2.get_action_list()) == 1, "Creator did not add the action" - - assert len(state2.get_event_filter_list()) == 0, "Creator assigner events to the final state" - -if __name__ == '__main__': - unittest.main() |