7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin########################################################################
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# This software is part of the ast package #
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner# Copyright (c) 1982-2010 AT&T Intellectual Property #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# and is licensed under the #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# Common Public License, Version 1.0 #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# by AT&T Intellectual Property #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# A copy of the License is available at #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# Information and Software Systems Research #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# AT&T Research #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# Florham Park NJ #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# David Korn <dgk@research.att.com> #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin########################################################################
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin integer -S count=0
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ "$got" == "$exp" ]] || err_exit "\${b.x} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( got == exp )) || err_exit "b.len incorrect for iteration $i -- expected $exp, got '$got = sqrt(${b.x}*${b.x}+${b.y}*${b.y})'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ "$got" == "$exp" ]] || err_exit "\${b.len} incorrect for iteration $i -- expected $exp, got '$got = sqrt(${b.x}*${b.x}+${b.y}*${b.y})'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ "$got" == "${exp}" ]] || err_exit "\${b.name} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( got == exp )) || err_exit "b.count incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ "$got" == "$exp" ]] || err_exit "\${b.ccount} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ "$got" == "$exp" ]] || err_exit "\${#b.colors[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#b.items[@]} == 3 ]] || err_exit "\${#b.items[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#bb.colors[@]} == 4 ]] || err_exit "\${#bb.colors[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#b.colors[@]} == 2 ]] || err_exit "\${#b.colors[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#b.items[@]} == 2 ]] || err_exit "\${#b.items[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#bb.colors[@]} == 2 ]] || err_exit "\${#bb.colors[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#bb.items[@]} == 2 ]] || err_exit "\${#bb.items[@]} incorrect for iteration $i -- expected $exp, got '$got'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $b == "$bb" ]] || err_exit "\$b='$b' != \$bb='$bb'"
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz[[ ${b.name} == box2 ]] || err_exit "\${b.name} incorrect -- expected box2, got '${b.name}'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( b.len == 5 )) || err_exit "b.len incorrect for box2 -- expected 5, got '$(( b.len ))'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( b.count == 1 )) || err_exit "b.count incorrect -- expected 1, got '$(( b.count ))'"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $c == $'(\n\ttypeset -l -E x=8\n\ttypeset -l -E y=5\n\tcomvar=(\n\t\ttop=8\n\t\tbottom=9\n\t)\n\ttypeset -S -l -i count=1\n\ttypeset -a items=(\n\t\tfoo\n\t\tbar\n\t)\n\ttypeset -A colors=(\n\t\t[floor]=red\n\t\t[wall]=blue\n\t)\n\tname=cube1\n\ttypeset -L 6 status=INIT\n\ttypeset -l -E z=1\n)' ]] || err_exit '$c not correct'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${c.depth} == 1 ]] || err_exit '${c.depth} != 1'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${c.name} == cube1 ]] || err_exit '${c.name} != cube1 '
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $(c.fun) == 'hello world' ]] || err_exit '$(c.fun) != "hello world"'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${c.fun} == 'hello world' ]] || err_exit '${c.fun} != "hello world"'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( abs(c.len - sqrt(90)) < 1e-10 )) || err_exit 'c.len != sqrt(90)'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( c.count == b.count )) || err_exit 'c.count != b.count'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chineval "Cube_t zzz=$c"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $zzz == "$c" ]] || err_exit '$zzz != $c without eval'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chineval "${xxx/c=/ccc=}"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chincc[2]=(x=2 y=3 name=two colors+=([table]=white) items+=(pencil) z=6)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[2].y} == 3 ]] || err_exit '${cc[2].y} != 3'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].y == 3 )) || err_exit '(( cc[2].y != 3))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[2].colors[table]} == white ]] || err_exit '${cc[2].colors[table]} != white'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[2].items[2]} == pencil ]] || err_exit '${cc[2].items[2]} != pencil'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].len == 7 )) || err_exit '(( cc[2].len != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $(cc[2].len) == 7 ]] || err_exit '$(cc[2].len) != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[2].len} == 7 ]] || err_exit '${cc[2].len} != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].count == 2 )) || err_exit 'cc[2].count != 2'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].len == cc[0].len )) || err_exit 'cc[2].len != cc[0].len'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].len == cc.len )) || err_exit 'cc[2].len != cc.len'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[2].count == 6 )) || err_exit 'cc[2].count != 6'
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz[[ $cc == "${cc[2]}" ]] || err_exit '$cc != ${cc[2]}'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chincc[two]=(x=2 y=3 name=two colors+=([table]=white) items+=(pencil) z=6)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#cc[@]} == 2 ]] || err_exit '${#cc[@]} != 2'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].y} == 3 ]] || err_exit '${cc[two].y} != 3'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].y == 3 )) || err_exit '(( cc[two].y != 3))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].colors[table]} == white ]] || err_exit '${cc[two].colors[table]} != white'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].items[2]} == pencil ]] || err_exit '${cc[two].items[2]} != pencil'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].len == 7 )) || err_exit '(( cc[two].len != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $(cc[two].len) == 7 ]] || err_exit '$(cc[two].len) != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].len} == 7 ]] || err_exit '${cc[two].len} != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].count == 2 )) || err_exit 'cc[two].count != 2'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].len == cc[one].len )) || err_exit 'cc[two].len != cc[one].len'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].count == 4 )) || err_exit 'cc[two].count != 4'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinunset cc[two].name unset cc[two].colors cc[two].items
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz[[ ${cc[one]} == "${cc[two]}" ]] || err_exit '${cc[one]} != ${cc[two]}'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin [two]=(x=2 y=3 name=two colors+=([table]=white) z=6)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#cc[@]} == 2 ]] || err_exit '${#cc[@]} != 2'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].y} == 3 ]] || err_exit '${cc[two].y} != 3'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].y == 3 )) || err_exit '(( cc[two].y != 3))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].colors[table]} == white ]] || err_exit '${cc[two].colors[table]} != white'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].len == 7 )) || err_exit '(( cc[two].len != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $(cc[two].len) == 7 ]] || err_exit '$(cc[two].len) != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two].len} == 7 ]] || err_exit '${cc[two].len} != 7 ))'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].count == 2 )) || err_exit 'cc[two].count != 2'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].len == cc[one].len )) || err_exit 'cc[two].len != cc[one].len'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin(( cc[two].count == 4 )) || err_exit 'cc[two].count != 4'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${cc[two]} == "${cc[three]}" ]] || err_exit ' ${cc[two]} != ${cc[three]}'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ $cc[two] == "${cc[three]}" ]] || err_exit ' $cc[two] != $cc[three]'
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin[[ ${#cc[@]} == 3 ]] || err_exit '${#cc[@]} != 3'