1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
# -*- tcl -*-
# finite_automaton.test: tests for the grammar::fa container.
#
# Copyright (c) 2004-2007 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
#
# RCS: @(#) $Id: fa_symbols.test,v 1.4 2007/04/12 03:43:15 andreas_kupries Exp $
# -------------------------------------------------------------------------
test fa-symbols-${setimpl}-1.0 {symbols, argument errors} {
grammar::fa a
catch {a symbols x} res
a destroy
set res
} {wrong # args: should be "::grammar::fa::Snit_methodsymbols type selfns win self"}
test fa-symbols-${setimpl}-1.1 {symbol mgmt} {
grammar::fa a
catch {a symbols x y} res
a destroy
set res
} {wrong # args: should be "::grammar::fa::Snit_methodsymbols type selfns win self"}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test fa-symbols-${setimpl}-2.0 {symbols, empty fa} {
grammar::fa a
set res [a symbols]
a destroy
set res
} {}
test fa-symbols-${setimpl}-2.1 {symbols, symbol addition} {
grammar::fa a
a symbol add x
set res [a symbols]
a destroy
set res
} x
test fa-symbols-${setimpl}-2.2 {symbols, symbol addition} {
grammar::fa a
a symbol add x y
set res [lsort [a symbols]]
a destroy
set res
} {x y}
test fa-symbols-${setimpl}-2.3 {symbols, symbol addition and removal} {
grammar::fa a
a symbol add x y
a symbol delete x
set res [a symbols]
a destroy
set res
} y
test fa-symbols-${setimpl}-2.4 {symbols, symbol addition and removal} {
grammar::fa a
a symbol add x y
a symbol delete y
set res [a symbols]
a destroy
set res
} x
test fa-symbols-${setimpl}-2.5 {symbols, symbol addition and removal} {
grammar::fa a
a symbol add x y
a symbol delete x y
set res [a symbols]
a destroy
set res
} {}
# -------------------------------------------------------------------------
::tcltest::cleanupTests
|