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

Automated code testing using CI/CD #32

Open
Alaz-Oz opened this issue Jan 20, 2024 · 9 comments
Open

Automated code testing using CI/CD #32

Alaz-Oz opened this issue Jan 20, 2024 · 9 comments
Assignees

Comments

@Alaz-Oz
Copy link
Member

Alaz-Oz commented Jan 20, 2024

There are actual codes in the repo (example codes). Those codes should be checked by the compiler and unit tests, so that there aren't any errors when we push any commit to the main branch.

So, I propose we use CI/CD for auto testing these programs for any errors.

The tests should perform:

  • Compilation check: Verifying if the program compiles successfully.
  • Test case checks: Verifying if the program does what it is expected to do.

The compilation check don't require any changes in the repo. But the Test case checks needs:

  • Input: Input for the running tests (input data)
  • Expected Output: What should the program output (if the output of the program doesn't matches the expected output, then the test case fails.

Majority of the program will have the input hardcoded (written in their source code), so only the Expected output is of concern.

So, how should we provide the expected output in the repo.

I propose we include a output.txt file for each program

@2G-Afroz
Copy link
Contributor

Yep, we should.

@Alaz-Oz
Copy link
Member Author

Alaz-Oz commented Jan 21, 2024

@2G-Afroz How would you like to add the expected output in the repo?
I could see 2 ways:

  • Add standard comment in the cpp file showing output.
  • Include a separate file that shoes output. (Every Code should have one then)

Note

We may temporarily make this repo c++ only, and further add other lang support as we go.

@2G-Afroz
Copy link
Contributor

we can include separate .txt file which will contain output of the code.
We will use same example in different codes so that there will only be one .txt(output) file.

@Alaz-Oz
Copy link
Member Author

Alaz-Oz commented Jan 21, 2024

What you meant by

We will use same example in different codes so that there will only be one .txt(output) file.

Does that means that different example codes (written in different programming lang) of the same algorithm will have single output?

@2G-Afroz
Copy link
Contributor

2G-Afroz commented Jan 22, 2024

Does that means that different example codes (written in different programming lang) of the same algorithm will have single output?

Yes

@2G-Afroz
Copy link
Contributor

And we will mention that example list/array in Standard.md file.

@Alaz-Oz
Copy link
Member Author

Alaz-Oz commented Jan 22, 2024

And we will mention that example list/array in Standard.md file.

Elaborate this.

@2G-Afroz
Copy link
Contributor

I want to say that we will mention the example list/array (like [ 2, 1, 7, -3, 9, 5, 19]) in Standard.md file.
So, whenever someone would want to contribute they will read Standard.md file and there they will get the example which they will have to use in Code Example.

@Alaz-Oz
Copy link
Member Author

Alaz-Oz commented Jan 25, 2024

Nope, that is not right. Different algo have different needs, like sorted/unsorted. So it is not right to be included in STANDARD.

My idea

  • Input that program will need in input.txt in the specific algorithm dir.
  • Output (Whatever the code will output) in output.txt in the same dir.
  • If there will be multiple codes then name will be like output1.txt, output2.txt, ...

Benefits

  • Easier to maintain: Independent io (input and output) of the program.
  • Freedom for dev: Coder could showcase a suitable test case, that demonstrate the code better.
  • CI/CD friendly: Easier to implement in CI/CD.

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

2 participants