Skip to content

Add aggressive_ignore_whitespace parameter for output comparison #40

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

first-storm
Copy link

I am a freshman and was stuck on an auto-test issue caused by a whitespace mismatch for an hour. To address this, I made this pull request.

This pull request introduces a new parameter called aggressive_ignore_whitespace for output comparison.

Local Testing Results

I have tested the changes locally, and here are the results:

╭─aoba@LMFuture-Laptop ~/Downloads  
╰─➤  python3 ~/Projects/autotest/autotest.py -a .                                   127 ↵
gcc -Wall -o test test.c
Test test1 (aggressive_ignore_whitespace=False (default)) - passed
Test test2 (aggressive_ignore_whitespace=True) - passed
Test test3 (aggressive_ignore_whitespace=True and ignore_trailing_whitespace=True) - passed
Test test4 (aggressive_ignore_whitespace=False and ignore_trailing_whitespace=True (original)) - passed
4 tests passed 0 tests failed

test.c

Here is the sample test.c file used for testing:

#include <stdio.h>

int main() {
    printf("Hello   \t  World!  \n");
    printf("Line 2  with space. \n");
    printf("NoSpaceLine3.\n");
    return 0;
}

tests.txt Configuration

Below is the tests.txt configuration file that defines the test cases:

files=test.c
default_compilers = {'c' : [['gcc', '-Wall', '-o', '%']]}

# Test aggressive_ignore_whitespace was disabled
test1 command="./test" expected_stdout="Hello   \t  World!  \nLine 2  with space. \nNoSpaceLine3.\n"
test1 description="aggressive_ignore_whitespace=False (default)"

# Test aggressive_ignore_whitespace was enabled
test2 aggressive_ignore_whitespace=True command="./test" expected_stdout="HelloWorld!\nLine2withspace.\nNoSpaceLine3.\n"
test2 description="aggressive_ignore_whitespace=True"

# Test aggressive_ignore_whitespace=True and ignore_trailing_whitespace=True were both enabled
test3 aggressive_ignore_whitespace=True ignore_trailing_whitespace=True command="./test" expected_stdout="HelloWorld!\nLine2withspace.\nNoSpaceLine3.\n"
test3 description="aggressive_ignore_whitespace=True and ignore_trailing_whitespace=True"

# Test aggressive_ignore_whitespace=False and ignore_trailing_whitespace=True were both enabled
test4 ignore_trailing_whitespace=True command="./test" expected_stdout="Hello   \t  World!\nLine 2  with space.\nNoSpaceLine3.\n"
test4 description="aggressive_ignore_whitespace=False and ignore_trailing_whitespace=True (original)"

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.

1 participant