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

add stresstesting scripts #31

Closed
wants to merge 10 commits into from
Closed

add stresstesting scripts #31

wants to merge 10 commits into from

Conversation

Alls-DeV
Copy link

compare.sh wrong slow generator numTests

  • wrong, slow and generator are respectively the executables of the two solutions and of the testcases generator

  • compare the outputs of two solutions of a problem, checking if they give the same outputs

  • for generate test case use uid(a, b) that generate a randomic number from [a, b]

    #define uid(a, b) uniform_int_distribution(a, b)(rng)
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


validate.sh solution validator generator numTests

  • solution, validator and generator are respectively the executables of the solution, validator of a solution and of the testcases generator
  • validator should return OK or the string that explain the error
  • validator first take in input the generator input and next the program output

@DannyAntonelli DannyAntonelli marked this pull request as draft November 11, 2022 19:58
@DannyAntonelli
Copy link
Contributor

We have to add the latex to include the changes in the pdf. Do we want to keep the examples in the repository? Having them in the pdf doesn't make sense.

@dp1 is it okay for you to keep these files in the tests/ folder even though they are unrelated to the unit testing you're adding?

@dp1
Copy link
Member

dp1 commented Nov 12, 2022

I like this PR, it seems quite involved to get stresstesting for all the booklet code, but it's good to have specific algorithms (e.g. geometry, maths) stresstested on a case by case basis.

@dp1
Copy link
Member

dp1 commented Nov 12, 2022

@DannyAntonelli I'm not sure what you mean with changes to the PDF, intuitively stresstesting shouldn't influence the final booklet. Am I missing something?

I'd also like to keep unit tests and stress tests as logically separate things, so maybe we could move this out into a stress-tests folder outside of tests (i.e., move the current stresstest folder outside of tests)

@dp1
Copy link
Member

dp1 commented Nov 12, 2022

One more thing, the examples are ok to have, but maybe we should have "real" stresstests as examples like we're starting to do in #30

@DannyAntonelli
Copy link
Contributor

@alls-cpp's idea is to put it in the booklet so that during the competition you can test the solution and see where it fails. That's how he usually uses these scripts, isn't it?

@dp1
Copy link
Member

dp1 commented Nov 12, 2022

Oh I see, I got the intent of this pr wrong. Yeah if this is to be used during the contest, we need to add some latex in content/ and move the scripts somewhere else, either in content/ itself or in source/. Maybe a subfolder in source?

tests/stresstest/compare.sh Outdated Show resolved Hide resolved
@Alls-DeV Alls-DeV marked this pull request as ready for review November 24, 2022 13:42
\item compare the outputs of two solutions of a problem, checking if they give the same outputs
\end{itemize}

\lstinputlisting{source/stresstest/compare.sh}
Copy link
Member

Choose a reason for hiding this comment

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

Would \snippet not work here?


\subsection{Stress test}
\subsubsection{Compare two solutions}
\texttt{compare.sh wrong slow generator numTests}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
\texttt{compare.sh wrong slow generator numTests}
\texttt{./compare.sh wrong slow generator numTests}

\lstinputlisting{source/stresstest/compare.sh}

\subsubsection{Validate a solution}
\texttt{validate.sh solution validator generator numTests}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
\texttt{validate.sh solution validator generator numTests}
\texttt{./validate.sh solution validator generator numTests}

@@ -7,3 +7,30 @@ \subsection{Compiling with sanitize options}
\begin{lstlisting}[breakatwhitespace=true]
g++ -std=gnu++17 -g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover file.cpp -o file
\end{lstlisting}

\subsection{Stress test}
Copy link
Member

Choose a reason for hiding this comment

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

I'd move this section to the end of the booklet, since it's not something we're going to use in all contests or at the start of one. We could add a misc section containing this code and potentially more in the future

@Alls-DeV Alls-DeV deleted the branch cp-sapienza:add-tests March 14, 2024 12:20
@Alls-DeV Alls-DeV closed this Mar 14, 2024
@Alls-DeV Alls-DeV deleted the add-tests branch March 14, 2024 12:20
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.

3 participants