Introduced pattern class

This commit is contained in:
Erik Frojdh
2020-11-27 10:03:15 +01:00
parent 8ca1d9c50c
commit d9b2a90651
22 changed files with 384 additions and 118 deletions

View File

@ -0,0 +1,31 @@
#include "catch.hpp"
#include "sls/Pattern.h"
using sls::Pattern;
TEST_CASE("Pattern is default constructable and has zeroed fields"){
Pattern p;
for (int i = 0; i!=MAX_PATTERN_LENGTH; ++i)
REQUIRE(p.data()->word[i] == 0);
REQUIRE(p.data()->ioctrl == 0);
}
TEST_CASE("Copy construct pattern"){
Pattern p;
p.data()->loop[0] = 7;
Pattern p1(p);
REQUIRE(p1.data()->loop[0] == 7);
}
TEST_CASE("Compare patterns"){
Pattern p;
Pattern p1;
REQUIRE(p == p1);
p1.data()->word[500] = 1;
REQUIRE_FALSE(p == p1);
}