diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b32957f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +Vasati +lib/ +*.o +tests/test_runner diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..289b88b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM gcc:latest + +WORKDIR /app + +COPY . . + +RUN make + +CMD ["./Vasati"] diff --git a/Makefile b/Makefile index 1900c75..7140fb9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,16 @@ -derle: topla -topla: main.o zaman.o pugi.o - g++ ./lib/main.o ./lib/zaman.o ./lib/pugi.o -o Vasati - -main.o: - g++ -I "./include" -c ./src/main.cpp -o ./lib/main.o -zaman.o: - g++ -I "./include" -c ./src/src-class/zaman.cpp -o ./lib/zaman.o -pugi.o: - g++ -I "./include/packages/pugixml-1.9/src" -c ./include/packages/pugixml-1.9/src/pugixml.cpp -o ./lib/pugi.o \ No newline at end of file +derle: init topla +init: + mkdir -p lib +topla: main.o zaman.o pugi.o + g++ ./lib/main.o ./lib/zaman.o ./lib/pugi.o -o Vasati + +test: topla + g++ -I "./include" tests/test_zaman.cpp ./lib/zaman.o ./lib/pugi.o -o tests/test_runner + ./tests/test_runner + +main.o: + g++ -I "./include" -c ./src/main.cpp -o ./lib/main.o +zaman.o: + g++ -I "./include" -c ./src/src-class/zaman.cpp -o ./lib/zaman.o +pugi.o: + g++ -I "./include/packages/pugixml-1.9/src" -c ./include/packages/pugixml-1.9/src/pugixml.cpp -o ./lib/pugi.o diff --git a/include/XML/Vakitler.xml b/include/XML/vakitler.xml similarity index 100% rename from include/XML/Vakitler.xml rename to include/XML/vakitler.xml diff --git a/include/include-class/Zaman.hpp b/include/include-class/zaman.hpp similarity index 100% rename from include/include-class/Zaman.hpp rename to include/include-class/zaman.hpp diff --git a/src/src-class/Zaman.cpp b/src/src-class/zaman.cpp similarity index 100% rename from src/src-class/Zaman.cpp rename to src/src-class/zaman.cpp diff --git a/tests/test_zaman.cpp b/tests/test_zaman.cpp new file mode 100644 index 0000000..9b197c8 --- /dev/null +++ b/tests/test_zaman.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include "include-class/zaman.hpp" + +void test_tkvm_h_v_d() { + zaman z; + + // Call the function explicitly + z.tkvm_h_v_d(); + + // Verify 'now' is properly set and within reasonable bounds + time_t current_time = time(0); + assert(z.now <= current_time); + assert(z.now >= current_time - 2); // allow small delay + + // Copy to avoid static buffer overwrites just in case + tm expected_ltm = *localtime(&z.now); + + assert(z.h_rakam_sene == (1900 + expected_ltm.tm_year)); + assert(z.h_rakam_ay == (1 + expected_ltm.tm_mon)); + assert(z.h_rakam_gun_ayin == expected_ltm.tm_mday); + assert(z.h_rakam_gun_senenin == (1 + expected_ltm.tm_yday)); + assert(z.h_rakam_gun_haftanin == expected_ltm.tm_wday); + + std::cout << "test_tkvm_h_v_d passed!" << std::endl; +} + +int main() { + std::cout << "Running tests..." << std::endl; + test_tkvm_h_v_d(); + std::cout << "All tests passed successfully." << std::endl; + return 0; +}