Skip to content

Conversation

@puresweep2
Copy link

@puresweep2 puresweep2 bot commented Oct 15, 2023

Description

This PR adds a new file add.go to the repository, which contains a function to add two numbers and return the sum. The function is implemented in Go and follows the naming convention addNumbers.

Summary of Changes

  • Created a new file add.go in the root directory of the repository.
  • Added the package declaration package main at the top of the file.
  • Defined a new function addNumbers that takes two integer parameters and returns their sum.

Please review and merge this PR. Thank you!

Fixes #7.


🎉 Latest improvements to Sweep:

  • Sweep can now passively improve your repository! Check out Rules to learn more.

💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

@puresweep2
Copy link
Author

puresweep2 bot commented Oct 15, 2023

Rollback Files For Sweep

  • Rollback changes to add.go

@puresweep2
Copy link
Author

puresweep2 bot commented Oct 15, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@puresweep2 puresweep2 bot added the sweep label Oct 15, 2023
@puresweep2 puresweep2 bot mentioned this pull request Oct 15, 2023
1 task
@puresweep2
Copy link
Author

puresweep2 bot commented Oct 15, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@taherv
Copy link
Owner

taherv commented Oct 15, 2023

Can you also add another function called "addComplexNumbers" that adds two Complex numbers and returns their sum ?
Do not modify the existing addNumbers function.

@puresweep2
Copy link
Author

puresweep2 bot commented Oct 15, 2023

🚀 Wrote Changes

Done.

@taherv
Copy link
Owner

taherv commented Oct 15, 2023

Can you add a unit test for addComplexNumbers ? Add it in a file called add_test.go and put that file in the same directory.

@puresweep2
Copy link
Author

puresweep2 bot commented Oct 15, 2023

🚀 Wrote Changes

Done.

a, b complex128
expected complex128
}{
{"add zero", 0, 0, 0},
Copy link
Owner

Choose a reason for hiding this comment

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

Add another test scenario here, for large numbers (e.g. 9 digit imaginary component of the complex number).

Copy link
Author

@puresweep2 puresweep2 bot Oct 15, 2023

Choose a reason for hiding this comment

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

🚀 Wrote Changes

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sweep: Add two numbers

2 participants