From 00663abfa30922fd947f6fbf8890431c93c127c1 Mon Sep 17 00:00:00 2001 From: hrocho Date: Tue, 17 Oct 2017 16:39:04 +0200 Subject: [PATCH] added storage tests --- storage.h | 2 +- tests/test_storage.cpp | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/storage.h b/storage.h index 583ba08..3495604 100644 --- a/storage.h +++ b/storage.h @@ -122,7 +122,7 @@ namespace catima{ ~Data(); void Add(const Projectile &p, const Material &t, Config c=default_config); int GetN() const {return storage.size();}; - void Reset(){storage.clear();storage.resize(max_storage_data);}; + void Reset(){storage.clear();storage.resize(max_storage_data);index=storage.begin();}; DataPoint& Get(const Projectile &p, const Material &t, Config c=default_config); int get_index() {return std::distance(storage.begin(),index);} private: diff --git a/tests/test_storage.cpp b/tests/test_storage.cpp index fe0ded7..4b7b646 100644 --- a/tests/test_storage.cpp +++ b/tests/test_storage.cpp @@ -4,7 +4,17 @@ using namespace std; #include "catima/catima.h" #include "catima/storage.h" -#include "catima/material_database.h" + +bool rcompare(double a, double b,double eps){ + if(fabs((a-b)/fabs(b))