File: concat.test

package info (click to toggle)
snack 2.2.10-dfsg1-12.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,024 kB
  • sloc: ansic: 35,473; sh: 8,557; tcl: 1,065; python: 701; makefile: 565
file content (52 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Commands covered: sound concatenate
#

package require -exact snack 2.2

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

test concatenate-1.1 {concatenate command} {
  set s1 [snack::sound snd1 -load ex1.wav]
  set s2 [snack::sound snd2]
  $s2 length 1000
  $s2 concatenate $s1
  set res [list [$s2 sample 999] [$s2 sample 6000] [$s2 sample 11000]]
  $s1 destroy
  $s2 destroy
  set res
} {0 7443 779}

test concatenate-1.2 {concatenate command, stereo} {
  set s1 [snack::sound snd1 -channels 2]
  set s2 [snack::sound snd2 -channels 2]
  $s1 length 1000
  $s1 sample 999 1 2
  $s2 length 1000
  $s2 sample 0 3 4
  $s1 concatenate $s2
  set res [list [$s1 sample 999] [$s1 sample 1000]]
  $s1 destroy
  $s2 destroy
  set res
} {{1 2} {3 4}}

test concatenate-1.3 {concatenate command, 3 channels} {
  set s1 [snack::sound snd1 -channels 3]
  set s2 [snack::sound snd2 -channels 3]
  $s1 length 1000
  $s1 sample 999 1 2 3
  $s2 length 1000
  $s2 sample 0 4 5 6
  $s1 concatenate $s2
  set res [list [$s1 sample 999] [$s1 sample 1000]]
  $s1 destroy
  $s2 destroy
  set res
} {{1 2 3} {4 5 6}}

# cleanup
::tcltest::cleanupTests
return