Sunday, 12 December 2010

Options And Choices

OK. I'm making the tools to make the tools to make the game. Specifically, I'm writing the test cases for the SceneEdit app which is going to simplify writing XML Scenes.

Next on my list of cases is Choice. Or, more accurately Option, If I know option loads itself correctly, then there are that many fewer things to go wrong when I load them from an option. Or load options into a narrative.

        [Test]
        def load_option():
#
#               I keep changin my mind about the capitalisation I want to use
#               on my XML tags. snippet vs Option; scene vs Choice. I think I'm
#               going to standardise on them all being lower case.
#
#               So this won't fit with the lua testcases s they stand -
#               I'll fix that in a bit
#
                source = detab("""
                        <option text="Have Sex" next="bonk" />
                """)

                using r = XmlReader.Create(StringReader(source)):
                        o = Option()
                        o.load(r)

                        Assert.AreEqual("Have Sex", o.text)
                        Assert.AreEqual("bonk", o.next)


And that passes.

No comments: