trying to get testing to work
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
project(Tart VERSION 0.1)
|
||||
# CPP
|
||||
#set( CMAKE_CXX_STANDARD 11)
|
||||
#set( CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set( CMAKE_CXX_STANDARD 11)
|
||||
set( CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# C
|
||||
set( CMAKE_C_STANDARD 11)
|
||||
set( CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/libs)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/libs)
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
||||
|
||||
set( CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "tart.h"
|
||||
#include <malloc.h>
|
||||
|
||||
struct tart_cell tart_test() {
|
||||
return {{0,0,0}, {0,0,0}, 0, 't'};
|
||||
}
|
||||
struct tart_buffer tart_create_buffer(tart_id id, struct tart_vec2 size, struct tart_vec2 position) {
|
||||
int cell_count = position.x * position.y;
|
||||
struct tart_cell* cells = malloc(sizeof(struct tart_cell[cell_count]));
|
||||
@@ -8,7 +11,8 @@ struct tart_buffer tart_create_buffer(tart_id id, struct tart_vec2 size, struct
|
||||
return buf;
|
||||
}
|
||||
struct tart_cell tart_create_cell(char display, tart_byte style, struct tart_rgb foreground, struct tart_rgb background) {
|
||||
return (struct tart_cell){foreground, background, style, display};
|
||||
struct tart_cell b = {{0,0,0}, {0,0,0}, 0, 't'};
|
||||
return b;
|
||||
}
|
||||
tart_byte tart_add_buffer(struct tart_window* window, struct tart_buffer buffer) {
|
||||
if(window->buffer_count < 0xFF) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
project(TartTest)
|
||||
set( CMAKE_CXX_STANDARD 11)
|
||||
set( CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set( SOURCES
|
||||
main.cpp
|
||||
test_tart.cpp
|
||||
)
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} )
|
||||
target_link_libraries(${PROJECT_NAME} PickleLib TartLib)
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#include <Pickler.h>
|
||||
int main (int argc, char *argv[]) {
|
||||
INSTALLSHELF;
|
||||
tart_run(&__pickle_shelf__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
62
testing/test_tart.cpp
Normal file
62
testing/test_tart.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "test_tart.h"
|
||||
#include "tart.h"
|
||||
bool rgb_test(struct tart_rgb* lhs, struct tart_rgb* rhs) {
|
||||
if(lhs->r != rhs->r) {return false;}
|
||||
if(lhs->g != rhs->g) {return false;}
|
||||
if(lhs->b != rhs->b) {return false;}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool vec2_test(struct tart_vec2* lhs, struct tart_vec2* rhs) {
|
||||
if(lhs->x != rhs->x) {return false;}
|
||||
if(lhs->y != rhs->y) {return false;}
|
||||
return true;
|
||||
}
|
||||
|
||||
void tart_run(struct pickle_shelf* shelf) {
|
||||
pickle_shelf __pickle_shelf__ = *shelf;
|
||||
CREATEJAR(tart_objects_test);
|
||||
PICKLE(Test_create_buffer) {
|
||||
|
||||
tart_buffer buffer_correct = {0,0,25,{20,20},{0,0}, 0};
|
||||
//tart_buffer buffer_test = tart_create_buffer(25,{20,20},{0,0});
|
||||
|
||||
//if(DIFFERENT(buffer_correct.cell_count,buffer_test.cell_count))
|
||||
// ASSERT("Cell count not the same.",false);
|
||||
//if(DIFFERENT(buffer_correct.layer,buffer_test.layer))
|
||||
// ASSERT("Layers not the same.",false);
|
||||
//if(DIFFERENT(buffer_correct.id,buffer_test.id))
|
||||
// ASSERT("Ids are not the same.",false);
|
||||
//if(DIFFERENT(buffer_correct.size.x,buffer_test.size.x))
|
||||
// ASSERT("size.x is not the same",false);
|
||||
//if(DIFFERENT(buffer_correct.size.y,buffer_test.size.y))
|
||||
// ASSERT("size.y is not the same",false);
|
||||
//if(DIFFERENT(buffer_correct.position.x,buffer_test.position.x))
|
||||
// ASSERT("position.x is not the same.",false);
|
||||
//if(DIFFERENT(buffer_correct.position.y,buffer_test.position.y))
|
||||
// ASSERT("position.y is not the same.",false);
|
||||
//if(DIFFERENT(&buffer_correct.cells,&buffer_test.cells))
|
||||
// ASSERT("cells address not the same should be 0",false);
|
||||
ASSERT("GOOD",true);
|
||||
}();
|
||||
|
||||
|
||||
PICKLE(Test_create_cell) {
|
||||
struct tart_rgb b = {80,80,80};
|
||||
struct tart_rgb f = {40,40,40};
|
||||
struct tart_cell cell_correct = {f, b, '1', 't'};
|
||||
struct tart_cell cell_test = tart_create_cell('f', 0x90, {0,0,0}, {0,0,0}); //tart_create_cell('t','1',f,b);
|
||||
//if(rgb_test(&cell_correct.foreground, &cell_test.foreground))
|
||||
// ASSERT("Forground dose not match.",false);
|
||||
//if(rgb_test(&cell_correct.background, &cell_test.background))
|
||||
// ASSERT("background dose not match.",false);
|
||||
//if(DIFFERENT(cell_correct.style, cell_test.style))
|
||||
// ASSERT("style dose not match.",false);
|
||||
//if(DIFFERENT(cell_correct.display, cell_test.display))
|
||||
// ASSERT("display dose not match.",false);
|
||||
ASSERT("GOOD",true);
|
||||
}();
|
||||
ADDPICKLE(tart_objects_test,Test_create_buffer);
|
||||
ADDPICKLE(tart_objects_test,Test_create_cell);
|
||||
shelf = &__pickle_shelf__;
|
||||
}
|
||||
@@ -1,2 +1,6 @@
|
||||
#include <tart.h>
|
||||
#include <Pickler.h>
|
||||
|
||||
bool rgb_test(struct tart_rgb* lhs, struct tart_rgb* rhs);
|
||||
bool vec2_test(struct tart_vec2* lhs, struct tart_vec2* rhs);
|
||||
void tart_run(struct pickle_shelf* shelf);
|
||||
|
||||
Reference in New Issue
Block a user