From 0ae20d7ca8a6aab24b8024bb2e258e0ae464d17b Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sun, 24 Oct 2021 19:26:34 +0000 Subject: [PATCH] clang-format and clang-tidy fixes for 00e7daaf --- data_structures/dsu_path_compression.cpp | 2 +- math/area.cpp | 56 +++++++++++++----------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/data_structures/dsu_path_compression.cpp b/data_structures/dsu_path_compression.cpp index a5c0aec33..022e632a7 100644 --- a/data_structures/dsu_path_compression.cpp +++ b/data_structures/dsu_path_compression.cpp @@ -184,7 +184,7 @@ static void test1() { * @returns void */ static void test2() { - // the minimum, maximum, and size of the set + // the minimum, maximum, and size of the set uint64_t n = 10; ///< number of items dsu d(n + 1); ///< object of class disjoint sets // set 1 diff --git a/math/area.cpp b/math/area.cpp index 6983cf3e4..3ed8f1fe9 100644 --- a/math/area.cpp +++ b/math/area.cpp @@ -1,17 +1,20 @@ /** * @file - * @brief Implementations for the [area](https://en.wikipedia.org/wiki/Area) of various shapes - * @details The area of a shape is the amount of 2D space it takes up. - * All shapes have a formula to get the area of any given shape. + * @brief Implementations for the [area](https://en.wikipedia.org/wiki/Area) of + * various shapes + * @details The area of a shape is the amount of 2D space it takes up. + * All shapes have a formula to get the area of any given shape. * These implementations support multiple return types. - * + * * @author [Focusucof](https://github.com/Focusucof) */ #define _USE_MATH_DEFINES -#include /// for M_PI definition and pow() +#include /// for assert +#include /// for M_PI definition and pow() #include /// for uint16_t datatype -#include /// for IO operations -#include /// for assert +#include /// for IO operations + +#include "math.h" /** * @namespace math @@ -115,25 +118,25 @@ T cylinder_surface_area(T radius, T height) { */ static void test() { // I/O variables for testing - uint16_t int_length; // 16 bit integer length input - uint16_t int_width; // 16 bit integer width input - uint16_t int_base; // 16 bit integer base input - uint16_t int_height; // 16 bit integer height input - uint16_t int_expected; // 16 bit integer expected output - uint16_t int_area; // 16 bit integer output + uint16_t int_length = 0; // 16 bit integer length input + uint16_t int_width = 0; // 16 bit integer width input + uint16_t int_base = 0; // 16 bit integer base input + uint16_t int_height = 0; // 16 bit integer height input + uint16_t int_expected = 0; // 16 bit integer expected output + uint16_t int_area = 0; // 16 bit integer output - float float_length; // float length input - float float_expected; // float expected output - float float_area; // float output + float float_length = NAN; // float length input + float float_expected = NAN; // float expected output + float float_area = NAN; // float output - double double_length; // double length input - double double_width; // double width input - double double_radius; // double radius input - double double_height; // double height input - double double_expected; // double expected output - double double_area; // double output + double double_length = NAN; // double length input + double double_width = NAN; // double width input + double double_radius = NAN; // double radius input + double double_height = NAN; // double height input + double double_expected = NAN; // double expected output + double double_area = NAN; // double output - // 1st test + // 1st test int_length = 5; int_expected = 25; int_area = math::square_area(int_length); @@ -201,7 +204,9 @@ static void test() { // 6th test double_radius = 6; - double_expected = 113.09733552923255; // rounded down because the double datatype truncates after 14 decimal places + double_expected = + 113.09733552923255; // rounded down because the double datatype + // truncates after 14 decimal places double_area = math::circle_area(double_radius); std::cout << "AREA OF A CIRCLE" << std::endl; @@ -239,7 +244,8 @@ static void test() { // 9th test double_radius = 10.0; - double_expected = 1256.6370614359172; // rounded down because the whole value gets truncated + double_expected = 1256.6370614359172; // rounded down because the whole + // value gets truncated double_area = math::sphere_surface_area(double_radius); std::cout << "SURFACE AREA OF A SPHERE" << std::endl;