Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Vasati
lib/
*.o
tests/test_runner
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM gcc:latest

WORKDIR /app

COPY . .

RUN make

CMD ["./Vasati"]
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions tests/test_zaman.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <cassert>
#include <ctime>
#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;
}