summaryrefslogtreecommitdiff
path: root/tests/run_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run_tests.cpp')
-rw-r--r--tests/run_tests.cpp164
1 files changed, 0 insertions, 164 deletions
diff --git a/tests/run_tests.cpp b/tests/run_tests.cpp
deleted file mode 100644
index e9092a6..0000000
--- a/tests/run_tests.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <stdio.h>
-
-#include "greatest.h"
-#include "timer.h"
-
-#include "strops.hpp"
-#include "administration.hpp"
-#include "administration_reader.hpp"
-#include "administration_writer.hpp"
-
-char* test_file_path = "C:\\Users\\aldri\\Desktop\\Vault\\Projects\\accounting\\build\\test.openbook";
-
-static void setup_cb(void *data) {
- (void)data;
- unlink(test_file_path);
-}
-
-static void teardown_cb(void *data) {
- (void)data;
- unlink(test_file_path);
-}
-
-TEST _administration_rw_taxbracket(void)
-{
- country_tax_bracket pw;
- country_tax_bracket pr;
- u32 count;
-
- administration_writer_create();
-
- administration_create_empty(test_file_path);
- {
- pw = administration_tax_bracket_create_empty();
- strops_copy(pw.country_code, "NL", sizeof(pw.country_code));
- pw.rate = 10.0f;
- strops_copy(pw.category_code, "S", sizeof(pw.category_code));
-
- count = administration_tax_bracket_count();
- administration_tax_bracket_add(pw);
-
- ASSERT_EQ(count+1, administration_tax_bracket_count());
- }
-
- administration_reader_open_existing(test_file_path);
- {
- ASSERT_EQ(count+1, administration_tax_bracket_count());
- ASSERT_EQ(1, administration_tax_bracket_get_by_id(&pr, pw.id));
- ASSERT_STR_EQ(pr.id, pw.id);
- ASSERT_STR_EQ(pr.country_code, pw.country_code);
- ASSERT_STR_EQ(pr.category_code, pw.category_code);
- ASSERT_EQ(pr.rate, pw.rate);
- }
-
- PASS();
-}
-
-TEST _administration_rw_costcenter(void)
-{
- cost_center pw;
- cost_center pr;
- u32 count;
-
- administration_writer_create();
-
- administration_create_empty(test_file_path);
- {
- pw = administration_cost_center_create_empty();
- strops_copy(pw.code, "CODE", sizeof(pw.code));
- strops_copy(pw.description, "Description", sizeof(pw.description));
-
- count = administration_cost_center_count();
- administration_cost_center_add(pw);
-
- ASSERT_EQ(count+1, administration_cost_center_count());
- }
-
- administration_reader_open_existing(test_file_path);
- {
- ASSERT_EQ(count+1, administration_cost_center_count());
- ASSERT_EQ(1, administration_cost_center_get_by_id(&pr, pw.id));
- ASSERT_STR_EQ(pr.id, pw.id);
- ASSERT_STR_EQ(pr.code, pw.code);
- ASSERT_STR_EQ(pr.description, pw.description);
- }
-
- PASS();
-}
-
-TEST _administration_rw_project(void)
-{
- project pw;
- project pr;
- u32 count;
-
- administration_writer_create();
-
- administration_create_empty(test_file_path);
- {
- pw = administration_project_create_empty();
- strops_copy(pw.description, "Test Project", sizeof(pw.description));
- count = administration_project_count();
- administration_project_add(pw);
-
- ASSERT_EQ(count+1, administration_project_count());
- }
-
- administration_reader_open_existing(test_file_path);
- {
- ASSERT_EQ(count+1, administration_project_count());
- ASSERT_EQ(1, administration_project_get_by_id(&pr, pw.id));
- ASSERT_STR_EQ(pr.id, pw.id);
- ASSERT_STR_EQ(pr.description, pw.description);
- }
-
- PASS();
-}
-
-TEST _administration_rw_contact(void)
-{
- contact pw;
- contact pr;
- u32 count;
-
- administration_writer_create();
-
- administration_create_empty(test_file_path);
- {
- pw = administration_contact_create_empty();
- count = administration_contact_count();
- administration_contact_add(pw);
-
- ASSERT_EQ(count+1, administration_contact_count());
- }
-
- administration_reader_open_existing(test_file_path);
- {
- ASSERT_EQ(count+1, administration_contact_count());
- ASSERT_EQ(1, administration_contact_get_by_id(&pr, pw.id));
- ASSERT_STR_EQ(pr.id, pw.id);
- }
-
- PASS();
-}
-
-SUITE(administration_io) {
- SET_SETUP(setup_cb, NULL);
- SET_TEARDOWN(teardown_cb, NULL);
-
- RUN_TEST(_administration_rw_taxbracket);
- RUN_TEST(_administration_rw_costcenter);
- RUN_TEST(_administration_rw_project);
- RUN_TEST(_administration_rw_contact);
-}
-
-GREATEST_MAIN_DEFS();
-int main(int argc, char **argv) {
- timer_lib_initialize();
-
- GREATEST_MAIN_BEGIN();
- RUN_SUITE(administration_io);
- GREATEST_MAIN_END();
-} \ No newline at end of file