fix ci and add formatting (#48)

* add dependency

* dont run blocking zmq example and add formatting

* format files
This commit is contained in:
Bechir Braham
2024-04-03 13:47:52 +02:00
committed by GitHub
parent 23c855acbc
commit 31a20d4f6c
34 changed files with 438 additions and 522 deletions

View File

@ -3,7 +3,7 @@
using aare::Frame;
TEST_CASE("Construct a frame"){
TEST_CASE("Construct a frame") {
ssize_t rows = 10;
ssize_t cols = 10;
ssize_t bitdepth = 8;
@ -13,20 +13,19 @@ TEST_CASE("Construct a frame"){
REQUIRE(frame.rows() == rows);
REQUIRE(frame.cols() == cols);
REQUIRE(frame.bitdepth() == bitdepth);
REQUIRE(frame.size() == rows*cols*bitdepth/8);
REQUIRE(frame.size() == rows * cols * bitdepth / 8);
// data should be initialized to 0
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
uint8_t *data = (uint8_t*)frame.get(i, j);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
uint8_t *data = (uint8_t *)frame.get(i, j);
REQUIRE(data != nullptr);
REQUIRE(*data == 0);
}
}
}
TEST_CASE("Set a value in a 8 bit frame"){
TEST_CASE("Set a value in a 8 bit frame") {
ssize_t rows = 10;
ssize_t cols = 10;
ssize_t bitdepth = 8;
@ -37,13 +36,12 @@ TEST_CASE("Set a value in a 8 bit frame"){
uint8_t value = 255;
frame.set(5, 7, value);
// only the value we did set should be non-zero
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
uint8_t *data = (uint8_t*)frame.get(i, j);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
uint8_t *data = (uint8_t *)frame.get(i, j);
REQUIRE(data != nullptr);
if (i == 5 && j == 7){
if (i == 5 && j == 7) {
REQUIRE(*data == value);
} else {
REQUIRE(*data == 0);
@ -52,7 +50,7 @@ TEST_CASE("Set a value in a 8 bit frame"){
}
}
TEST_CASE("Set a value in a 64 bit frame"){
TEST_CASE("Set a value in a 64 bit frame") {
ssize_t rows = 10;
ssize_t cols = 10;
ssize_t bitdepth = 64;
@ -63,13 +61,12 @@ TEST_CASE("Set a value in a 64 bit frame"){
uint64_t value = 255;
frame.set(5, 7, value);
// only the value we did set should be non-zero
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
uint64_t *data = (uint64_t*)frame.get(i, j);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
uint64_t *data = (uint64_t *)frame.get(i, j);
REQUIRE(data != nullptr);
if (i == 5 && j == 7){
if (i == 5 && j == 7) {
REQUIRE(*data == value);
} else {
REQUIRE(*data == 0);
@ -78,28 +75,27 @@ TEST_CASE("Set a value in a 64 bit frame"){
}
}
TEST_CASE("Move construct a frame"){
TEST_CASE("Move construct a frame") {
ssize_t rows = 10;
ssize_t cols = 10;
ssize_t bitdepth = 8;
Frame frame(rows, cols, bitdepth);
std::byte* data = frame.data();
std::byte *data = frame.data();
Frame frame2(std::move(frame));
//state of the moved from object
// state of the moved from object
REQUIRE(frame.rows() == 0);
REQUIRE(frame.cols() == 0);
REQUIRE(frame.bitdepth() == 0);
REQUIRE(frame.size() == 0);
REQUIRE(frame.data() == nullptr);
//state of the moved to object
// state of the moved to object
REQUIRE(frame2.rows() == rows);
REQUIRE(frame2.cols() == cols);
REQUIRE(frame2.bitdepth() == bitdepth);
REQUIRE(frame2.size() == rows*cols*bitdepth/8);
REQUIRE(frame2.size() == rows * cols * bitdepth / 8);
REQUIRE(frame2.data() == data);
}