about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_format.rb14
-rw-r--r--test/test_source_sox.rb13
2 files changed, 13 insertions, 14 deletions
diff --git a/test/test_format.rb b/test/test_format.rb
index ba039a7..00fb3e3 100644
--- a/test/test_format.rb
+++ b/test/test_format.rb
@@ -34,20 +34,6 @@ class TestFormat < Minitest::Unit::TestCase
     assert_nil hash["channels"]
   end
 
-  def test_from_file
-    Tempfile.open(%w(tmp .wav)) do |tmp|
-      # generate an empty file with 1s of audio
-      cmd = %W(sox -r 96000 -b 24 -c 2 -n #{tmp.path} trim 0 1)
-      system(*cmd)
-      assert $?.success?, "#{cmd.inspect} failed: #$?"
-      fmt = DTAS::Format.new
-      fmt.from_file tmp.path
-      assert_equal 96000, fmt.rate
-      assert_equal 2, fmt.channels
-      tmp.unlink
-    end
-  end
-
   def test_bytes_per_sample
     fmt = DTAS::Format.new
     assert_equal 4, fmt.bytes_per_sample
diff --git a/test/test_source_sox.rb b/test/test_source_sox.rb
index 6bf5071..f2e0699 100644
--- a/test/test_source_sox.rb
+++ b/test/test_source_sox.rb
@@ -99,4 +99,17 @@ class TestSource < Minitest::Unit::TestCase
     source = DTAS::Source::Sox.new(tmp.path, '1')
     assert_equal 1000000.0, source.offset_us
   end
+
+  def test_format_from_file
+    Tempfile.open(%w(tmp .wav)) do |tmp|
+      # generate an empty file with 1s of audio
+      cmd = %W(sox -r 96000 -b 24 -c 2 -n #{tmp.path} trim 0 1)
+      system(*cmd)
+      assert $?.success?, "#{cmd.inspect} failed: #$?"
+      fmt = DTAS::Source::Sox.new(tmp.path).format
+      assert_equal 96000, fmt.rate
+      assert_equal 2, fmt.channels
+      tmp.unlink
+    end
+  end
 end