From 74ed85075819146fe9be4310bb709d80fa96c294 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Sat, 20 May 2023 09:03:25 +0200 Subject: Implemented lunch() like a boss The lunch() function was pretty broken in v0.2.0-alpha, so a long lunch would cause all sorts of problems. Not anymore, friends! --- src/main.odin | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/main.odin') diff --git a/src/main.odin b/src/main.odin index 89ff39e..d64d5e3 100644 --- a/src/main.odin +++ b/src/main.odin @@ -4,12 +4,23 @@ import "core:fmt" main :: proc() { //test() - new_workday({10, 22, 1, 5, 2023}, - {00, 08, 5, 5, 2023}, - {00, 05, 6, 5, 2023}, - {30, 21, 5, 5, 2023}) + workday: = new_workday({10, 22, 4, 5, 2023}, + {00, 08, 5, 5, 2023}, + {00, 05, 6, 5, 2023}, + {30, 21, 5, 5, 2023}) + //lunch(&workday, {00, 16, 5, 5, 2023}, {00, 17, 5, 5, 2023}) + lunch(&workday, {00, 12, 5, 5, 2023}, {45, 22, 5, 5, 2023}) + //lunch(&workday, {00, 12, 5, 5, 2023}, {30, 12, 5, 5, 2023}) + //lunch(&workday, {30, 16, 5, 5, 2023}, {30, 17, 5, 5, 2023}) + //lunch(&workday, {30, 19, 5, 5, 2023}, {30, 22, 5, 5, 2023}) + for each_block, i in workday.blocks { + fmt.printf("Block %2i: %s $f: %i%% %s\n", i+1, toString(each_block), int((each_block.value-1)*100), each_block.reason) + } } +// TODO: Separate tests into different procedures +// TODO: Write dedicated tests for lunch + test :: proc() { fmt.println("\n--- TESTING PRINT STUFFS ---") -- cgit v1.2.1