Posted to tcl by sebres at Tue Mar 16 12:56:37 GMT 2021view raw

  1. test compExpr-8.2 {Compile and execute compare operator (no numeric conversion)} -setup {
  2. interp create li
  3. interp eval li {
  4. set a [string repeat 1234567890 10000]
  5. set a "$a-Z-$a"
  6. set b ""
  7. set c "c"
  8. }
  9. # restrict evaluation time to 3 seconds (if no regression it takes few microseconds):
  10. interp limit li time -granularity 1 -seconds [expr {[clock seconds]+3}]
  11. } -body {
  12. interp eval li {list \
  13. [expr {$a=="" && $a!="" || $a=="" && $a!="" || $a<"" && $a>"" || $a<="" && $a>=""}] \
  14. [expr {""==$a && ""!=$a || ""==$a && ""!=$a || ""<$a && "">$a || ""<=$a && "">=$a}] \
  15. [expr {$a=="a" && $a!="a" || $a=="a" && $a!="a" || $a<"a" && $a>"a" || $a<="a" && $a>="a"}] \
  16. [expr {"a"==$a && "a"!=$a || "a"==$a && "a"!=$a || "a"<$a && "a">$a || "a"<=$a && "a">=$a}] \
  17. [expr {$a==$b && $a!=$b || $a==$b && $a!=$b || $a<$b && $a>$b || $a<=$b && $a>=$b}] \
  18. [expr {$a==$c && $a!=$c || $a==$c && $a!=$c || $a<$c && $a>$c || $a<=$c && $a>=$c}]
  19. }
  20. } -result {0 0 0 0 0 0} -cleanup {
  21. interp delete li
  22. }
  23.