[segyio] 368/376: Add test for segyio-cath

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit 86c1eb9019d60bb87fb2be198cde5ee7b87e6d34
Author: krrstatoil <krr at statoil.com>
Date:   Thu Aug 24 15:23:26 2017 +0200

    Add test for segyio-cath
---
 applications/CMakeLists.txt |  2 ++
 applications/test/cath.py   | 59 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt
index 5823131..9842f8d 100644
--- a/applications/CMakeLists.txt
+++ b/applications/CMakeLists.txt
@@ -44,3 +44,5 @@ install(TARGETS segyio-crop DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 add_python_test(applications.catr test/catr.py)
 add_python_test(applications.catb test/catb.py)
+add_python_test(applications.cath test/cath.py)
+
diff --git a/applications/test/cath.py b/applications/test/cath.py
new file mode 100644
index 0000000..3b2abdb
--- /dev/null
+++ b/applications/test/cath.py
@@ -0,0 +1,59 @@
+import unittest
+import subprocess
+import os
+
+class TestSegyH(unittest.TestCase):
+
+    actual = [
+        b"C 2 AN INCREASE IN AMPLITUDE EQUALS AN INCREASE IN ACOUSTIC IMPEDANCE",
+        b"C 3 Written by libsegyio (python)",
+        b"C 4",
+        b"C 5",
+        b"C 6",
+        b"C 7",
+        b"C 8",
+        b"C 9",
+        b"C10",
+        b"C11 TRACE HEADER POSITION:",
+        b"C12   INLINE BYTES 189-193    | OFFSET BYTES 037-041",
+        b"C13   CROSSLINE BYTES 193-197 |",
+        b"C14",
+        b"C15 END EBCDIC HEADER",
+    ]
+    work_dir = '../../build'
+    cmd_base = './applications/segyio-cath'
+    FNULL = open(os.devnull, 'w')
+
+    def test_help(self):
+        cmd = self.cmd_base + ' --help'
+        result = subprocess.check_output(cmd, shell=True, cwd=self.work_dir)
+        self.assertEqual(result[0:18], b'Usage: segyio-cath')
+
+
+    def test_segy_in(self):
+        cmd = self.cmd_base + ' python/test-data/small.sgy'
+        result = subprocess.check_output(cmd, shell=True,
+                 cwd=self.work_dir).split(b'\n')
+        for i in range(len(self.actual)):
+            self.assertEqual(self.actual[i].strip(), b''+result[i + 1].strip())
+
+    def test_none_segy_in(self):
+        cmd = self.cmd_base + ' ../CMakeLists.txt'
+        result = subprocess.call(cmd, shell=True,
+                 stderr=self.FNULL, cwd=self.work_dir)
+        self.assertEqual(result, 0)
+
+    def test_none_file(self):
+        cmd = self.cmd_base + ' nothing'
+        result = subprocess.check_output(cmd, shell=True,
+                 stderr=self.FNULL, cwd=self.work_dir)
+        self.assertEqual(result, b'')
+
+    def test_empty_string_in(self):
+        cmd = self.cmd_base + ' ';
+        result = subprocess.call(cmd, shell=True, stderr=self.FNULL,
+		stdout=self.FNULL, cwd=self.work_dir)
+        self.assertEqual(result, 0)
+
+if __name__ == '__main__':
+    unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list