From 5f42941cfc74f6e2c7dc5e3f785f1d09f18fb79c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Tue, 21 Jul 2020 11:32:04 +0100
Subject: [PATCH] TEST: Test vest convert scripts

---
 tests/test_scripts/test_vest2text.py | 47 ++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 tests/test_scripts/test_vest2text.py

diff --git a/tests/test_scripts/test_vest2text.py b/tests/test_scripts/test_vest2text.py
new file mode 100644
index 000000000..15cca4f5a
--- /dev/null
+++ b/tests/test_scripts/test_vest2text.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# test_vest2text.py -
+#
+# Author: Paul McCarthy <pauldmccarthy@gmail.com>
+#
+
+import numpy as np
+
+import fsl.data.vest         as fslvest
+import fsl.scripts.Text2Vest as Text2Vest
+import fsl.scripts.Vest2Text as Vest2Text
+
+from tests import tempdir
+
+
+def test_usage():
+    assert Vest2Text.main([]) == 0
+    assert Text2Vest.main([]) == 0
+
+
+def test_Vest2Text():
+    with tempdir():
+        data = np.random.random((20, 10))
+        vest = fslvest.generateVest(data)
+
+        with open('data.vest', 'wt') as f:
+            f.write(vest)
+
+        assert Vest2Text.main(['data.vest', 'data.txt']) == 0
+
+        got = np.loadtxt('data.txt')
+
+        assert np.all(np.isclose(data, got))
+
+
+def test_Text2Vest():
+    with tempdir():
+        data = np.random.random((20, 10))
+
+        np.savetxt('data.txt', data)
+
+        assert Text2Vest.main(['data.txt', 'data.vest']) == 0
+
+        got = fslvest.loadVestFile('data.vest', ignoreHeader=False)
+
+        assert np.all(np.isclose(data, got))
-- 
GitLab