CRIMP
Artifact [82807f3dc5]
Not logged in

Artifact 82807f3dc523ca903db698db5c33d91e674f5ded:


# -*- tcl -*-
# -------------------------------------------------------------------------

source [file join \
            [file dirname [file join [pwd] [info script]]] \
            testutilities.tcl]

testsNeedTcl     8.5
testsNeedTcltest 2

support { useLocalFile synth.tcl }
support { useC [mainPath _test/lib]/crimp_core* crimp::core no }
testing { useC [mainPath _test/lib]/crimp*      crimp       no }

# -------------------------------------------------------------------------
## Flipping images at the major symmetry axes
#
## TODO (implementation): fpcomplex.
# -------------------------------------------------------------------------

test crimp-flip-1.0 {image flip, wrong\#args, not enough} -body {
    crimp flip
} -returnCodes error -result {wrong # args: should be "crimp flip subcommand ?argument ...?"}

test crimp-flip-1.1 {image flip, invalid method} -body {
    crimp flip BOGUS
} -returnCodes error -result {unknown or ambiguous subcommand "BOGUS": must be horizontal, transpose, transverse, or vertical}

# -------------------------------------------------------------------------

test crimp-flip-2.0 {image flip horizontal, wrong\#args, not enough} -body {
    crimp flip horizontal
} -returnCodes error -result {wrong # args: should be "crimp flip horizontal image"}

test crimp-flip-2.1 {image flip horizontal, wrong\#args, too many} -body {
    crimp flip horizontal I toomuch
} -returnCodes error -result {wrong # args: should be "crimp flip horizontal image"}

set n 2
foreach itype [types] {
    test crimp-flip-2.$n "image flip horizontal, $itype" -body {
	crimp write 2string tcl [crimp flip horizontal [$itype]]
    } -result [fliph [t_$itype]] \
	-constraints [expr {$itype ne "fpcomplex"
			    ? ""
			    : "NotImplemented"}]
    incr n
}

# -------------------------------------------------------------------------

test crimp-flip-3.0 {image flip vertical, wrong\#args, not enough} -body {
    crimp flip vertical
} -returnCodes error -result {wrong # args: should be "crimp flip vertical image"}

test crimp-flip-3.1 {image flip vertical, wrong\#args, too many} -body {
    crimp flip vertical I toomuch
} -returnCodes error -result {wrong # args: should be "crimp flip vertical image"}

set n 2
foreach itype [types] {
    test crimp-flip-3.$n "image flip vertical, $itype" -body {
	crimp write 2string tcl [crimp flip vertical [$itype]]
    } -result [flipv [t_$itype]] \
	-constraints [expr {$itype ne "fpcomplex"
			    ? ""
			    : "NotImplemented"}]
    incr n
}

# -------------------------------------------------------------------------

test crimp-flip-4.0 {image flip transpose, wrong\#args, not enough} -body {
    crimp flip transpose
} -returnCodes error -result {wrong # args: should be "crimp flip transpose image"}

test crimp-flip-4.1 {image flip transpose, wrong\#args, too many} -body {
    crimp flip transpose I toomuch
} -returnCodes error -result {wrong # args: should be "crimp flip transpose image"}

set n 2
foreach itype [types] {
    test crimp-flip-4.$n "image flip transpose, $itype" -body {
	crimp write 2string tcl [crimp flip transpose [$itype]]
    } -result [fliptp [t_$itype]]
    incr n
}

# -------------------------------------------------------------------------

test crimp-flip-5.0 {image flip transverse, wrong\#args, not enough} -body {
    crimp flip transverse
} -returnCodes error -result {wrong # args: should be "crimp flip transverse image"}

test crimp-flip-5.1 {image flip transverse, wrong\#args, too many} -body {
    crimp flip transverse I toomuch
} -returnCodes error -result {wrong # args: should be "crimp flip transverse image"}

set n 2
foreach itype [types] {
    test crimp-flip-5.$n "image flip transverse, $itype" -body {
	crimp write 2string tcl [crimp flip transverse [$itype]]
    } -result [fliptv [t_$itype]] \
	-constraints [expr {$itype ne "fpcomplex"
			    ? ""
			    : "NotImplemented"}]
    incr n
}

# -------------------------------------------------------------------------
## Handling of input location and geometry: Pass through.

foreach {k op} {
    2 horizontal
    3 vertical
    4 transpose
    5 transverse
} {
    set n 10
    foreach itype [types] {
	test crimp-flip-$k.$n "image flip $op, $itype, input handling" -body {
	    crimp at [crimp flip $op [crimp place [$itype] 4 5]]
	} -result {4 5} \
	    -constraints [expr {($itype ne "fpcomplex") && ($op ne "transpose")
				? ""
				:"NotImplemented"}]
	incr n
    }
}

# -------------------------------------------------------------------------
testsuiteCleanup

# Local variables:
# mode: tcl
# indent-tabs-mode: nil
# End: