Skip to content

Add aggressive_ignore_whitespace parameter for output comparison#40

Open
first-storm wants to merge 1 commit intoCOMP1511UNSW:mainfrom
first-storm:dismiss-linebreaks-spaces
Open

Add aggressive_ignore_whitespace parameter for output comparison#40
first-storm wants to merge 1 commit intoCOMP1511UNSW:mainfrom
first-storm:dismiss-linebreaks-spaces

Conversation

@first-storm
Copy link
Copy Markdown

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