summaryrefslogtreecommitdiff
path: root/utils/sv_test.cc
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2013-11-28 11:11:22 +0100
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2013-11-28 11:11:22 +0100
commitab02696b1c104febc7f13c896acf4165f2721018 (patch)
tree61969895daa79d1d67c90f4adc1de7d91ef3cdfd /utils/sv_test.cc
parentab63f2f2988e0093a721d0599c7fe68e183561d8 (diff)
parente346cd5cd3c5d7164819c35e485a9850d825996e (diff)
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'utils/sv_test.cc')
-rw-r--r--utils/sv_test.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/sv_test.cc b/utils/sv_test.cc
new file mode 100644
index 00000000..c7ac9e54
--- /dev/null
+++ b/utils/sv_test.cc
@@ -0,0 +1,24 @@
+#define BOOST_TEST_MODULE WeightsTest
+#include <boost/test/unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include "sparse_vector.h"
+
+using namespace std;
+
+BOOST_AUTO_TEST_CASE(Equality) {
+ SparseVector<double> x;
+ SparseVector<double> y;
+ x.set_value(1,-1);
+ y.set_value(1,-1);
+ BOOST_CHECK(x == y);
+}
+
+BOOST_AUTO_TEST_CASE(Division) {
+ SparseVector<double> x;
+ SparseVector<double> y;
+ x.set_value(1,1);
+ y.set_value(1,-1);
+ BOOST_CHECK(!(x == y));
+ x /= -1;
+ BOOST_CHECK(x == y);
+}