Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: pre existing algorithm area.cpp to follow guidelines #2522

Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0741849
chore: removed duplicate header
Jul 21, 2023
2c467c9
chore: reordered module doxygen comment
Jul 21, 2023
178762e
chore: fixed some of the header documentation.
Jul 21, 2023
d29f583
chore: added T parameter tag
Jul 21, 2023
fe5980a
chore: added some more tparam tags
Jul 21, 2023
c5052e1
chare: note to self about how to tidy this module.
Jul 21, 2023
b24c2e6
Merge branch 'TheAlgorithms:master' into Fix-pre-existing-algorithm-a…
rbevin777 Jul 21, 2023
093b648
fix: specific data types for area calculation
Jul 22, 2023
15aafe0
chore: using wider data type for square area
Jul 22, 2023
e5aa286
fix: specified specific types for rectangle area calculation
Jul 22, 2023
2d35c53
fix: fixed type issue with triangle area
Jul 22, 2023
fe85a0e
fix: set specific data types for area of circle
Jul 22, 2023
c4e1850
fix: updated parallelogram function
Jul 22, 2023
04c7447
fix: cube surface area function
Jul 22, 2023
404036b
fix: sphere surface area funcion
Jul 22, 2023
e322c7f
docs: updated function comments
Jul 22, 2023
53e8d6b
fix: fixed cylinder surface area functionality
Jul 22, 2023
20ccc36
test: removed bulky test case
Jul 22, 2023
dd21680
Merge commit 'b24c2e607bcb42f10643317520bc7db02b043738' into Fix-pre-…
Jul 22, 2023
6dc4662
Merge branch 'TheAlgorithms:master' into Fix-pre-existing-algorithm-a…
rbevin777 Aug 5, 2023
ba3f7a3
chore: added some more comments and added another test
Aug 5, 2023
a886cf7
fix: removed undeclared variables
Aug 5, 2023
06be4e8
fix: removed unused functions
Aug 5, 2023
3b02ed3
docs: updated gherkin test comments.
Aug 5, 2023
ac1db38
chore: added triangle area test
Aug 5, 2023
55248bd
Merge commit '6dc46621ad83655f522a7ea93b8a0fd238f936e5' into Fix-pre-…
Aug 5, 2023
47d72d5
docs: added correct docs name
Aug 5, 2023
c375cdf
chore: added circle area test
Aug 5, 2023
005d4d5
chore: added parallelogram area test.
Aug 5, 2023
6020dba
chore: added cube surface area test
Aug 5, 2023
bd6726f
chore: added tests now one for each function.
Aug 5, 2023
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
Prev Previous commit
Next Next commit
chore: added cube surface area test
rbevin777 committed Aug 5, 2023
commit 6020dbaacfbca6db0591780e068e858125a22596
21 changes: 21 additions & 0 deletions math/area.cpp
Original file line number Diff line number Diff line change
@@ -249,6 +249,26 @@ static void test_parallelogram_area_functionality() {
std::cout << "TEST PASSED: Parallelogram Area" << std::endl << std::endl;
}

/**
* @brief This self test is used to test the basic functionality of the
* cube_surface_area function to see if it behaves as expected.
* @returns void
*/
static void test_cube_surface_area_functionality() {
// Given we the length of one face of the cube.
uint16_t cube_face_length = 4121u;

// When we calculate the cube surface area.
uint64_t actual_cube_surface_area =
math::cube_surface_area(cube_face_length);

// Then we should get the area calculated as we expect.
// is the expected == actual?
assert(101895846u == actual_cube_surface_area);

std::cout << "TEST PASSED: Cube Surface Area" << std::endl << std::endl;
}

/**
* @brief Main function
* @returns 0 on exit
@@ -259,5 +279,6 @@ int main() {
test_triangle_area_functionality();
Copy link
Collaborator

@realstealthninja realstealthninja Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please condense all these tests into a single function i.e

static void tests() {
 test_**_**(); // more info on test 
 test_**_**(): // more info on test 
}

test_circle_area_functionality();
test_parallelogram_area_functionality();
test_cube_surface_area_functionality();
return 0;
}