#!../gasp

source common.tcl

load ./validate_basic.so
load ./validate_advanced.so

if {[lindex $argv  0] == "-d" || [lindex $argv  0] == "-v"} {
	set debug 1
	set argv [lrange $argv 1 end]
}

#-------------------------------------------------------------------------------------------------
#
#	USAGE		validate [-d or -v] [file ...]
#
#-------------------------------------------------------------------------------------------------
#
#	FUNCTIONS
#
#		init list_of_strings			initialize the packet with the concatenation of all the
#										strings
#
#		enter protocol					decode the content of the packet starting with 'protocol'
#
#		show							dump packet (hex+mappers) only if debug mode
#
#		vg field value [limits]			validate of get for 'field' for protocol defined in
#										'enter'. 'value' is the expected result. 'limits' is an
#										optional argument for testing the limits of the field.
#
#		vs field value [limits]			same as above but set the value before getting and
#										validating it
#
#		vgp protocol field value [limits] as above but with explicit protocol
#
#-------------------------------------------------------------------------------------------------

if {[llength $argv]} {
	foreach file $argv {
		source $file
	}
} else {
	foreach file [lsort [glob *.tcl]] {
		if {$file != "common.tcl" && $file != "compiler_validate.tcl"} {
			source $file
		}
	}
}
