From 81a36b7b056413030334ab01d738b29d77f7989d Mon Sep 17 00:00:00 2001
From: Claudio Mandrioli <claudio.mandrioli@control.lth.se>
Date: Thu, 28 Feb 2019 10:39:42 +0100
Subject: [PATCH] added test case for function q2dcm

---
 matlab/tests/main_runAllTests.m |  2 +-
 matlab/tests/test_q2dcm.m       | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 matlab/tests/test_q2dcm.m

diff --git a/matlab/tests/main_runAllTests.m b/matlab/tests/main_runAllTests.m
index a28915d..1ae7a6e 100644
--- a/matlab/tests/main_runAllTests.m
+++ b/matlab/tests/main_runAllTests.m
@@ -12,5 +12,5 @@ test_GPSaidedINS_car
 test_GPSaidedINS_cycling
 test_gravity
 test_Nav_eq
-% test_q2dcm
+test_q2dcm
 % test_Rt2d
\ No newline at end of file
diff --git a/matlab/tests/test_q2dcm.m b/matlab/tests/test_q2dcm.m
new file mode 100644
index 0000000..dad63f4
--- /dev/null
+++ b/matlab/tests/test_q2dcm.m
@@ -0,0 +1,25 @@
+% test case for function q2dcm
+
+%purpose: test the function in a basic case to verify it runs correctly and
+%         returns a 3x3 matrix
+
+%oracle: verify that the output is an identity matrix for null rotation
+
+clear all             %clear workspace 
+close all
+cd ..                 %move to functions directory           
+
+%define inputs
+q=[0,0,0,0];
+
+%execute function
+R=q2dcm(q);
+
+cd tests              %go back to tests directory
+
+%verify output
+if ~(R==eye(3))
+    error('error in function q2dcm')
+else
+    disp('function q2dcm ok')
+end
\ No newline at end of file
-- 
GitLab