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

Code review from Nastya aka BimodalCape O_o #1

Open
BimodaCape opened this issue Apr 21, 2023 · 1 comment
Open

Code review from Nastya aka BimodalCape O_o #1

BimodaCape opened this issue Apr 21, 2023 · 1 comment

Comments

@BimodaCape
Copy link
Collaborator

don't use absolute path, use relative one

#include "D:\ASD\doctest.h"

don't use default values in public invocations, move fishy assignment to body, nullptr is strange why not empty array, "{" to new line
Matrix(int** arr = nullptr, size_t n = 0, size_t m = 0) :n_(n), m_(m) {

rows are not initialized, is it supposed to be so?
rows_.push_back(pair<size_t, list<pair<size_t, int>>>(i, list<pair<size_t, int>>()));

instead of size_t use auto keyword (will be automaticaly adjust to int type)
for (size_t j = 0; j < m_; j++)

"{" to new line
if (arr[i][j] != 0) {

"{" to new line
if (rows_.back().second.empty()) {

remove if not used
~Matrix() {}

add brackets
~Matrix() {}

logic with that one is too complex, it can be simplified
int* element = nullptr;

just return second element here, at the end return 0, int* element can be removed
element = &it_j->second;

prefer to use _n, _m
size_t n_, m_;

Unit test should test 1 item at a time, divide those to separate tests
TEST_CASE("Testing Matrix") {

bad practice to assign elemnts inside function invocation
CHECK_NOTHROW(t = m.Add(&m1));

@BimodaCape
Copy link
Collaborator Author

BimodaCape commented Apr 21, 2023

decided approach is too complex *(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant