From fe671029c34407d3d4408980b3dc378c0f4e0e63 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 26 Apr 2023 11:26:03 -0600 Subject: [PATCH 1/3] docs: improve contributing guidelines --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14385a12b62..a65dcc14d6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,6 +116,8 @@ static void tests() { assert(is_number_on_array(arr, 9) == true); assert(is_number_on_array(arr, 4) == false); + + std::cout << "All tests have successfully passed!\n"; } /** @@ -192,6 +194,9 @@ static void test() { assert(func(...) == ...); // this ensures that the algorithm works as expected // can have multiple checks + + // this lets the user know that the tests have passed + std::cout << "All tests have successfully passed!\n"; } /** From 4ca4333efef5cc2ea74120291dbaa7eb02b9c010 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 26 Apr 2023 18:59:57 -0600 Subject: [PATCH 2/3] docs: add more tests in the contributing guidelines --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a65dcc14d6e..49337d79562 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,6 +116,8 @@ static void tests() { assert(is_number_on_array(arr, 9) == true); assert(is_number_on_array(arr, 4) == false); + assert(is_number_on_array(arr, 98) == true); + assert(is_number_on_array(arr, 512) == false); std::cout << "All tests have successfully passed!\n"; } From c0c27153cdd632dd824b4a698f28ae29233483c6 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 26 Apr 2023 19:08:19 -0600 Subject: [PATCH 3/3] fix: self-test example not working --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49337d79562..13202ce4e76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,8 +81,9 @@ assert(backtracking::subset_sum::number_of_subsets(0, array1) == 3. Small C++ program that showcases and explains the use of tests. ```cpp -#include /// for std::vector -#include /// for assert +#include /// for IO operations +#include /// for std::vector +#include /// for assert /** * @brief Verifies if the given array @@ -100,7 +101,7 @@ bool is_number_on_array(const std::vector &arr, const int &number) { return true; } else { - return false; + // Number not in the current index, keep searching. } }