ycl

Artifact [68c0ddf6a2]
Login

Artifact [68c0ddf6a2]

Artifact 68c0ddf6a289ece2829dcf4518481beb535ce7b0:


#! /bin/env tclsh

package require {ycl test}

proc suite_main {} {
	[yclprefix]::test::init

	package require {ycl proc}
	[yclprefix] proc alias alias [yclprefix] proc alias
	alias aliases [yclprefix] proc aliases

	aliases {
		{ycl math} {
			base
			max
		}
		{ycl list} {
			sl
		}
		{ycl test} {
			cleanup1
		}
	}

	alias [yclprefix]::math::expr


	test base {} -body {
		set res {}
		foreach {from to number} [sl {
			16 10 {1 0}
			16 10 {1 0 0}
			16 10 {1 0 1} 
			16 10 {1 1 1}
			10 10 {1 0} 
			10 16 {1 6}
			10 16 {2 7 3}

			256 58 {243 251 251 251 1 178 31 9 31 29}
			58 256 {13 41 1 56 10 34 22 39 0 9 40 31 14 5}

			256 58 {243 251 251 251 1 178 31 9 32 29}
			58 256 {13 41 1 56 10 34 22 39 0 9 40 31 18 29}

			256 58 {243 251 251 251 1 178 31 9 33 29}
			58 256 {13 41 1 56 10 34 22 39 0 9 40 31 22 53}

			256 58 {1 1 1 1 1 1}
			58 256 {28 57 43 5 37 29 35}

			256 58 {1 1 1 1 1 1 1}
			58 256  {2 11 56 50 12 53 32 38 29}

			256 58 {1 1 1 1 1 1 1 1}
			58 256 {9 42 50 57 39 2 24 9 54 1}

			256 58 {1 1 1 1 1 1 1 1 1}
			58 256 {42 57 15 4 32 18 38 39 48 24 25}

			256 58 {72 101 108 108 111 31}
			58 256 {36 2 56 11 0 19 18 47}

			256 58 {72 101 108 108 111 32}
			58 256 {36 2 56 11 0 19 18 48}

			256 58 {72 101 108 108 111 99 3}
			58 256 {2 43 7 6 0 33 27 22 11 37}

			256 58 {72 101 108 108 111 47 13}
			58 256 {2 43 7 6 0 33 27 18 14 17}

			256 58 {72 101 108 108 111 32 13}
			58 256 {2 43 7 6 0 33 27 17 6 5}
			
			256 58 {72 101 108 108 111 250 33}
			58 256 {2 43 7 6 0 33 27 33 40 37}

			256 58 {72 101 108 108 111 32 87 111 114 108 100}
			58 256 {17 55 14 0 1 26 49 54 27 22 3 4 10 20 36} 
		}] {
			set converted $number
			base $from $to converted
			set number2 $converted
			base $to $from number2
			if {$number2 ne $number} {
				lappend res $number $from $to $converted $number2
			}
		}
		return $res
	} -cleanup [cleanup1] -result [sl {
	}]


	test expr {} -body {
		expr res1 1 + 2
		lappend res $res1
		return $res
	} -cleanup [cleanup1] -result [sl {
		3
	}]


	test expr_break {} -body {
		while 1 {
			expr res1 {[break]}
			set res1 fail1
			break
		}
		if {[info exists res1]} {
			lappend res fail2
		}
		lappend res success 
		return $res
	} -cleanup [cleanup1] -result [sl {
		success
	}]


	test expr_onerg {} -body {
		expr {3 + 5}
		lappend res $expr
		return $res
	} -cleanup [cleanup1] -result [sl {
		8
	}]


	test max {} -body {
		set list {10 8 1 7 29 2}
		max list
		return $list
	} -cleanup [cleanup1] -result [sl {
		29
	}]



	cleanupTests
}