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

Added >, <, <=, >= operators along with tests #48

Merged
merged 7 commits into from
Oct 9, 2020

Conversation

yashsoni501
Copy link
Contributor

@yashsoni501 yashsoni501 commented Oct 7, 2020

Description of Change

Feature add

Operator overloads for >, <, <=, >= are added for largeInt datatype. Test cases randomly generated using python along with some handwritten test cases are also added

Checklist

  • Added description of change
  • Proper file name given
  • Added tests and example, test must pass
  • Relevant documentation/comments is changed or added
  • PR title follows semantic
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Copy link
Owner

@ayaankhan98 ayaankhan98 left a comment

Choose a reason for hiding this comment

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

please don't use .txt files for the purpose of testing of these operators. write direct assert statements in the .cpp file itself.
use of .txt file seems reasonable for stream operators but not for these operators.

@yashsoni501
Copy link
Contributor Author

please don't use .txt files for the purpose of testing of these operators. write direct assert statements in the .cpp file itself.
use of .txt file seems reasonable for stream operators but not for these operators.

I highly suggest to use text file for input to the tester as it makes it easier to generate test cases, makes writing the code much easier and also make the test data expandable. Since the constructors and stream operators are already tested, embedding the test cases in the tester doesn't provide any advantage. To make the codebase look cleaner, I can move all the input files into a separate folder

@ayaankhan98
Copy link
Owner

ayaankhan98 commented Oct 7, 2020

I highly suggest to use text file for input to the tester as it makes it easier to generate test cases, makes writing the code much easier and also make the test data expandable. Since the constructors and stream operators are already tested, embedding the test cases in the tester doesn't provide any advantage. To make the codebase look cleaner, I can move all the input files into a separate folder

if generation of test case is a matter then we can use some pseudo random number generator to generate random inputs over a range, this is much more easier and it also takes care of most of the possible test cases. Using text files for testing is not recommended generally.

@yashsoni501
Copy link
Contributor Author

I highly suggest to use text file for input to the tester as it makes it easier to generate test cases, makes writing the code much easier and also make the test data expandable. Since the constructors and stream operators are already tested, embedding the test cases in the tester doesn't provide any advantage. To make the codebase look cleaner, I can move all the input files into a separate folder

if generation of test case is a matter then we can use some pseudo random number generator to generate random inputs over a range, this is much more easier and it also takes care of most of the possible test cases. Using text files for testing is not recommended generally.

But pseudorandom number generation method is not feasible here as we don't know what should be the correct output for those randomly generated numbers. This is why I've used python to generate test cases as it supports operations over large integers

@yashsoni501
Copy link
Contributor Author

I've updated the tester to use automated test case generator using random integers. This was indeed useful as it helped me find some cases where the code failed. I've made the required changes.

Copy link
Owner

@ayaankhan98 ayaankhan98 left a comment

Choose a reason for hiding this comment

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

another good practice is to use ++i instead of i++, prefix operators are a bit more optimised.

@ayaankhan98
Copy link
Owner

@yashsoni501 soon we will have doxygen setup to auto generate the documentation for this library. Therefore i will be nice if you include proper documentation for each and everything along with illustrated examples in accordance with doxygen guidelines

Copy link
Owner

Codacy Here is an overview of what got changed by this pull request:

Clones added
============
- tests/operators/greater_equal_test.cpp  1
- tests/operators/less_than_test.cpp  1
- tests/operators/less_equal_test.cpp  1
- tests/operators/greater_than_test.cpp  1
         

See the complete overview on Codacy

Copy link
Owner

@ayaankhan98 ayaankhan98 left a comment

Choose a reason for hiding this comment

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

Needs improvement in further PR's.
Approving and Merging just in order to to enable some basic functional units for further development

@ayaankhan98 ayaankhan98 merged commit 5b90a3a into ayaankhan98:main Oct 9, 2020
@ayaankhan98 ayaankhan98 changed the title Added >, <, <=, >= operators along with tests for largeInt data type Added >, <, <=, >= operators along with tests Oct 9, 2020
@ayaankhan98 ayaankhan98 linked an issue Oct 9, 2020 that may be closed by this pull request
17 tasks
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

Successfully merging this pull request may close these issues.

[feat] operator overloads
2 participants