diff --git a/build/test/cache/test_timequiz.c b/build/test/cache/test_timequiz.c index e69de29..cb30133 100644 --- a/build/test/cache/test_timequiz.c +++ b/build/test/cache/test_timequiz.c @@ -0,0 +1,47 @@ +#include "src/timequiz.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void) { + + + +} + + + + + +void tearDown(void) { + + + +} + + + +void test_getRandomQuestionIndex(void) { + + int askedQuestions[10] = {0}; + + int totalQuestions = 10; + + + + + + int index = getRandomQuestionIndex(askedQuestions, totalQuestions); + + + + + + do {if ((index >= 0 && index < totalQuestions)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(24)));}} while(0); + +} diff --git a/build/test/dependencies/test_timequiz.d b/build/test/dependencies/test_timequiz.d index e204044..4089084 100644 --- a/build/test/dependencies/test_timequiz.d +++ b/build/test/dependencies/test_timequiz.d @@ -1 +1,4 @@ -build/test/out/c/test_timequiz.o: test/test_timequiz.c +build/test/out/c/test_timequiz.o: test/test_timequiz.c \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/timequiz.h diff --git a/build/test/out/c/test_timequiz.o b/build/test/out/c/test_timequiz.o index f1baf79..6cb41f6 100644 Binary files a/build/test/out/c/test_timequiz.o and b/build/test/out/c/test_timequiz.o differ diff --git a/build/test/out/c/test_timequiz_runner.o b/build/test/out/c/test_timequiz_runner.o index dfaa1c5..00aa4a8 100644 Binary files a/build/test/out/c/test_timequiz_runner.o and b/build/test/out/c/test_timequiz_runner.o differ diff --git a/build/test/out/c/timequiz.o b/build/test/out/c/timequiz.o index 2648300..85f7ee5 100644 Binary files a/build/test/out/c/timequiz.o and b/build/test/out/c/timequiz.o differ diff --git a/build/test/out/test_timequiz.out b/build/test/out/test_timequiz.out index d00c64d..f9f8630 100755 Binary files a/build/test/out/test_timequiz.out and b/build/test/out/test_timequiz.out differ diff --git a/build/test/preprocess/files/test_timequiz.c b/build/test/preprocess/files/test_timequiz.c index e69de29..cb30133 100644 --- a/build/test/preprocess/files/test_timequiz.c +++ b/build/test/preprocess/files/test_timequiz.c @@ -0,0 +1,47 @@ +#include "src/timequiz.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void) { + + + +} + + + + + +void tearDown(void) { + + + +} + + + +void test_getRandomQuestionIndex(void) { + + int askedQuestions[10] = {0}; + + int totalQuestions = 10; + + + + + + int index = getRandomQuestionIndex(askedQuestions, totalQuestions); + + + + + + do {if ((index >= 0 && index < totalQuestions)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(24)));}} while(0); + +} diff --git a/build/test/preprocess/includes/test_timequiz.c b/build/test/preprocess/includes/test_timequiz.c index dcd024e..3036273 100644 --- a/build/test/preprocess/includes/test_timequiz.c +++ b/build/test/preprocess/includes/test_timequiz.c @@ -1 +1,3 @@ ---- [] +--- +- C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h +- src/timequiz.h diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index e85cee3..1766bda 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.01796970000032161 +:time: 0.014249100000597537 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index fb42ca9..e93e0e3 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.014309700000012526 +:time: 0.0164414000000761 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index f929b3d..74ad0af 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -2,13 +2,17 @@ :source: :path: test :file: test_timequiz.c -:successes: [] +:successes: +- :test: test_getRandomQuestionIndex + :line: 16 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 0 - :passed: 0 + :total: 1 + :passed: 1 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.014682400000310736 +:time: 0.02380760000050941 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index fdf9ca4..a34f8fa 100644 --- a/build/test/results/test_wwm.pass +++ b/build/test/results/test_wwm.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.014739700000063749 +:time: 0.014939400000002934 diff --git a/build/test/runners/test_timequiz_runner.c b/build/test/runners/test_timequiz_runner.c index cab2e2f..bd1bc90 100644 --- a/build/test/runners/test_timequiz_runner.c +++ b/build/test/runners/test_timequiz_runner.c @@ -10,6 +10,7 @@ char* GlobalOrderError; /*=======External Functions This Runner Calls=====*/ extern void setUp(void); extern void tearDown(void); +extern void test_getRandomQuestionIndex(void); /*=======Mock Management=====*/ @@ -26,12 +27,6 @@ static void CMock_Destroy(void) { } -/*=======Setup (stub)=====*/ -void setUp(void) {} - -/*=======Teardown (stub)=====*/ -void tearDown(void) {} - /*=======Test Reset Options=====*/ void resetTest(void); void resetTest(void) @@ -48,10 +43,39 @@ void verifyTest(void) CMock_Verify(); } +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + /*=======MAIN=====*/ int main(void) { UnityBegin("test_timequiz.c"); + run_test(test_getRandomQuestionIndex, "test_getRandomQuestionIndex", 16); return UnityEnd(); } diff --git a/test/test_timequiz.c b/test/test_timequiz.c index e69de29..7eb6cab 100644 --- a/test/test_timequiz.c +++ b/test/test_timequiz.c @@ -0,0 +1,27 @@ +#ifdef TEST + +#include "unity.h" +#include "timequiz.h" + +// Test setup function +void setUp(void) { + // This function will be called before each test +} + +// Test teardown function +void tearDown(void) { + // This function will be called after each test +} + +void test_getRandomQuestionIndex(void) { + int askedQuestions[10] = {0}; + int totalQuestions = 10; + + // Call the function to get a random question index + int index = getRandomQuestionIndex(askedQuestions, totalQuestions); + + // Assert that the index is within the valid range + TEST_ASSERT_TRUE(index >= 0 && index < totalQuestions); +} + +#endif //TEST