home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / tsipp / tsipp.lha / tsipp3.0a / tests / misc.test < prev    next >
Encoding:
Text File  |  1992-11-02  |  4.5 KB  |  213 lines

  1. #==============================================================================
  2. #                                 misc.test
  3. #------------------------------------------------------------------------------
  4. # Test of the Tcl SIPP misc commands.
  5. #------------------------------------------------------------------------------
  6. # Copyright 1992 Mark Diekhans
  7. # Permission to use, copy, modify, and distribute this software and its
  8. # documentation for any purpose and without fee is hereby granted, provided
  9. # that the above copyright notice appear in all copies.  Mark Diekhans makes
  10. # no representations about the suitability of this software for any purpose.
  11. # It is provided "as is" without express or implied warranty.
  12. #------------------------------------------------------------------------------
  13. # $Id: misc.test,v 2.0 1992/11/02 03:55:55 markd Rel $
  14. #==============================================================================
  15.  
  16.  
  17. if {[info procs test] == ""} {source testprocs.tcl}
  18.  
  19. #
  20. # Test SippMkVector command.
  21. #
  22.  
  23. test {misc-1.1} {
  24.     SippMkVector {0 0 0}
  25. } 1 {wrong # args: SippMkVector {pt0_x pt0_y pt0_z} {pt1_x pt1_y pt1_z}}
  26.  
  27. test {misc-1.2} {
  28.     SippMkVector {0 0 0} {1 1 1} {2 2 2}
  29. } 1 {wrong # args: SippMkVector {pt0_x pt0_y pt0_z} {pt1_x pt1_y pt1_z}}
  30.  
  31. test {misc-1.3} {
  32.     SippMkVector {0 0} {1 1 1}
  33. } 1 {vertex or vector must be a list of three elements}
  34.  
  35. test {misc-1.4} {
  36.     SippMkVector {0 0 0} {1 1 a}
  37. } 1 {expected floating-point number but got "a"}
  38.  
  39. test {misc-1.5} {
  40.     SippMkVector {0 0 0} {1 1 a}
  41. } 1 {expected floating-point number but got "a"}
  42.  
  43. test {misc-1.6} {
  44.     SippMkVector {0 0 0} {1 1 1}
  45. } 0 {1 1 1}
  46.  
  47. test {misc-1.7} {
  48.     SippMkVector {0.5 0.5 0.5} {2.25 1.75 1.75}
  49. } 0 {1.75 1.25 1.25}
  50.  
  51. test {misc-1.8} {
  52.     SippMkVector {1 1 1} {0 0 0}
  53. } 0 {-1 -1 -1}
  54.  
  55. #
  56. # Test SippMatMult command.
  57. #
  58.  
  59. test {misc-2.1} {
  60.     SippMatMult
  61. } 1 {wrong # args: SippMatMult matrix1 matrix2}
  62.  
  63. test {misc-2.2} {
  64.     SippMatMult $testMat1 $identityMat $testMat1
  65. } 1 {wrong # args: SippMatMult matrix1 matrix2}
  66.  
  67. test {misc-2.3} {
  68.     SippMatMult {0 1 2 3} {4 5 6 7}
  69. } 1 {matrix must have 4 columns}
  70.  
  71. test {misc-2.4} {
  72.     SippMatMult $identityMat {4 5 6 7}
  73. } 1 {matrix must have 4 columns}
  74.  
  75. test {misc-2.5} {
  76.     SippMatMult $identityMat $testMat1
  77. } 0 $testMat1
  78.  
  79. test {misc-2.6} {
  80.     SippMatMult $testMat1 $identityMat
  81. } 0 $testMat1
  82.  
  83. #
  84. # Test SippShowBackFaces command.
  85. #
  86.  
  87. test {misc-3.1} {
  88.     SippShowBackFaces 0 1
  89. } 1 {wrong # args: SippShowBackFaces [flag]}
  90.  
  91. test {misc-3.2} {
  92.     SippShowBackFaces true
  93.     SippShowBackFaces
  94. } 0 {1}
  95.  
  96. test {misc-3.3} {
  97.     SippShowBackFaces false
  98.     SippShowBackFaces
  99. } 0 {0}
  100.  
  101. #
  102. # Test SippBackground command.
  103. #
  104.  
  105. test {misc-4.1} {
  106.     SippBackground 1 2 3
  107. } 1 {wrong # args: SippBackground [color]}
  108.  
  109. test {misc-4.2} {
  110.     SippBackground {0 .9 .4} {0 .9 .4}
  111. } 1 {wrong # args: SippBackground [color]}
  112.  
  113. test {misc-4.3} {
  114.     SippBackground {0 .9 .4}
  115. } 0 {}
  116.  
  117. test {misc-4.4} {
  118.     SippBackground {1 .9 .4}
  119.     SippBackground
  120. } 0 {1 0.9 0.4}
  121.  
  122. #
  123. # Test SippLineColor command.
  124. #
  125.  
  126. test {misc-5.1} {
  127.     SippLineColor 1 2 3
  128. } 1 {wrong # args: SippLineColor [color]}
  129.  
  130. test {misc-5.2} {
  131.     SippLineColor {0 .9 .4} {0 .9 .4}
  132. } 1 {wrong # args: SippLineColor [color]}
  133.  
  134. test {misc-5.3} {
  135.     SippLineColor {1 0 1}
  136. } 0 {}
  137.  
  138. test {misc-5.4} {
  139.     SippLineColor {1 0 0.1}
  140.     SippLineColor
  141. } 0 {1 0 0.1}
  142.  
  143. #
  144. # Test SippShadows command.
  145. #
  146.  
  147. test {misc-6.1} {
  148.     SippShadows
  149. } 1 {wrong # args: SippShadows flag [size]}
  150.  
  151. test {misc-6.2} {
  152.     SippShadows true 1000 1
  153. } 1 {wrong # args: SippShadows flag [size]}
  154.  
  155. test {misc-6.3} {
  156.     SippShadows foo
  157. } 1 {expected boolean value but got "foo"}
  158.  
  159. test {misc-6.4} {
  160.     SippShadows true
  161. } 1 {size argument must be specified when enabling shadows}
  162.  
  163. test {misc-6.5} {
  164.     SippShadows false 1000
  165. } 1 {size argument must be omitted when disabling shadows}
  166.  
  167. test {misc-6.6} {
  168.     SippShadows true 1000
  169. } 0 {}
  170.  
  171. test {misc-6.7} {
  172.     SippShadows false
  173. } 0 {}
  174.  
  175.  
  176. #
  177. # Test SippInfo command.
  178. #
  179.  
  180. test {misc-7.1} {
  181.     SippInfo
  182. } 1 {wrong # args: SippInfo attribute}
  183.  
  184. test {misc-7.2} {
  185.     SippInfo rle x
  186. } 1 {wrong # args: SippInfo attribute}
  187.  
  188. test {misc-7.3} {
  189.     SippInfo foo
  190. } 1 {expected an attribute of "version", "sippversion", "tsippversion", "tsipppatchlevel", or "rle", got "foo"}
  191.  
  192. test {misc-7.4} {
  193.     lempty [SippInfo version]
  194. } 0 0
  195.  
  196. test {misc-7.5} {
  197.     lempty [SippInfo sippversion]
  198. } 0 0
  199.  
  200. test {misc-7.6} {
  201.     lempty [SippInfo tsippversion]
  202. } 0 0
  203.  
  204.  
  205. test {misc-7.7} {
  206.     lempty [SippInfo tsipppatchlevel]
  207. } 0 0
  208.  
  209. test {misc-7.8} {
  210.     expr {[lsearch {0 1} [SippInfo rle]] >= 0}
  211. } 0 1
  212.  
  213.