# Commands covered: sound crop
#

package require -exact snack 2.2

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import ::tcltest::*
}

test crop-1.1 {crop command} {
  set s [snack::sound snd]
  $s length 300000
  $s sample 1000 17
  $s sample 299000 17
  $s crop 1000 299000
  set res [list [$s sample 0] [$s sample 298000]]
  $s destroy
  set res
} {17 17}

test crop-1.2 {crop command, stereo} {
  set s [snack::sound snd -channels 2]
  $s length 300000
  $s sample 1000 17 18
  $s sample 299000 17 18
  $s crop 1000 299000
  set res [list [$s sample 0] [$s sample 298000]]
  $s destroy
  set res
} {{17 18} {17 18}}

test crop-1.3 {crop command, 3 channels} {
  set s [snack::sound snd -channels 3]
  $s length 300000
  $s sample 1000 17 18 19
  $s sample 299000 17 18 19
  $s crop 1000 299000
  set res [list [$s sample 0] [$s sample 298000]]
  $s destroy
  set res
} {{17 18 19} {17 18 19}}

# cleanup
::tcltest::cleanupTests
return
