summaryrefslogtreecommitdiff
path: root/lib/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core/tests')
-rw-r--r--lib/core/tests/memory.cpp18
-rw-r--r--lib/core/tests/particles.cpp23
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/core/tests/memory.cpp b/lib/core/tests/memory.cpp
new file mode 100644
index 0000000..27cd938
--- /dev/null
+++ b/lib/core/tests/memory.cpp
@@ -0,0 +1,18 @@
+#include <forstio/test/suite.hpp>
+
+#include "../c++/memory.hpp"
+
+namespace {
+namespace sch {
+using namespace saw::schema;
+}
+
+SAW_TEST("Memory Estimate"){
+ using namespace kel::lbm;
+
+ SAW_EXPECT((memory_estimate<sch::Float32>().get() == 4u), std::string{"Float32 isn't 4 bytes, but "} + std::to_string(memory_estimate<sch::Float32>().get()) );
+ SAW_EXPECT((memory_estimate<sch::FixedArray<sch::Float32,5u,3u>>().get() == 60u), "FixedArray<Float32,5u,3u> isn't 60 bytes");
+ SAW_EXPECT((memory_estimate<sch::FixedArray<sch::Float32,5u,3u>, sch::UInt8>().get() == 61u), "FixedArray<Float32,5u,3u> + UInt8 isn't 61 bytes");
+}
+
+}
diff --git a/lib/core/tests/particles.cpp b/lib/core/tests/particles.cpp
index b2581f7..fcca19a 100644
--- a/lib/core/tests/particles.cpp
+++ b/lib/core/tests/particles.cpp
@@ -150,6 +150,29 @@ SAW_TEST("Moving particles 2D"){
SAW_EXPECT(has_collided, "Expecting collision within those steps");
}
+SAW_TEST("Particle Matrix Rotation"){
+ using namespace kel;
+
+ saw::data<sch::Particle<sch::T,2u>> part_a;
+ {
+ auto& body = part_a.template get<"rigid_body">();
+ auto& pos = body.template get<"position">();
+ auto& pos_old = body.template get<"position_old">();
+ auto& coll = part_a.template get<"collision">();
+ auto& radius = coll.template get<"radius">();
+ auto& acc = body.template get<"acceleration">();
+
+ radius.set(1.0);
+
+ pos.at({{0u}}) = -5.0;
+ pos.at({{1u}}) = 0.2;
+ pos_old = pos;
+ }
+
+
+
+}
+
SAW_TEST("Particle Collision Impulse"){
using namespace kel;