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

[Fix] The way of getting testcases #36

Merged
merged 6 commits into from
Jun 20, 2024
Merged

[Fix] The way of getting testcases #36

merged 6 commits into from
Jun 20, 2024

Conversation

logic-finder
Copy link
Contributor

@logic-finder logic-finder commented Jun 18, 2024

The current way is inconvenient and inherently dangerous: the program can't check whether a testcase is written within the memory block acquired from the malloc() call.

@logic-finder logic-finder requested a review from lshqqytiger June 18, 2024 09:07
@logic-finder logic-finder self-assigned this Jun 18, 2024
@lshqqytiger
Copy link
Contributor

Suggestion: Use macro.

#define test(name, argv, input, output) \
  add(tests, &tlen, (testcase) { \
    .name = name, \
    .argv = argv, \
    .input = input, \
    .output = output \
  });
test("usual", "10", "I hate programming in C so much.", "Ihateprogr\namminginCs\nomuch.I'mg\nettinghead\nache.\n");
test(...);
...

@logic-finder logic-finder marked this pull request as draft June 19, 2024 06:35
@logic-finder logic-finder marked this pull request as ready for review June 19, 2024 06:36
test/test.c Outdated Show resolved Hide resolved
@logic-finder logic-finder requested a review from lshqqytiger June 19, 2024 15:17
Copy link
Contributor

@lshqqytiger lshqqytiger left a comment

Choose a reason for hiding this comment

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

🟢 LGTM

@lshqqytiger
Copy link
Contributor

CI will be restarted today.

@lshqqytiger lshqqytiger merged commit 3b1006c into main Jun 20, 2024
13 checks passed
@logic-finder logic-finder deleted the lf/fix-test branch June 20, 2024 04:28
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.

2 participants