# -*- 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
