leontastic / test-utilities Goto Github PK
View Code? Open in Web Editor NEWA repository of utilities written to make testing CS assignments faster.
License: MIT License
A repository of utilities written to make testing CS assignments faster.
License: MIT License
When generating tests, the first generated test contains unnecessary newlines before the contents of each file. Given a testfile with the following first case:
0=
0
The test input t0.in is generated with a single newline before the specified input:
0=
And the test output t0.out is generated with two newlines before the specified output:
0
In most cases this will cause the test to fail due to whitespace discrepancy. I believe the issue has something to do with the generation of the array when reading the testfile expressed in this chunk of code:
i=0
s=1
declare -a tests
KEY=$RANDOM
sed '/^ *#/ d' < ${TESTFILE} > /tmp/tmp-$KEY.txt
while read -r line; do
# If we find an empty line, then we increase the counter (i),
# set the flag (s) to one, and skip to the next line
[[ $line == "" ]] && ((i++)) && s=1 && continue
# If the flag (s) is zero, then we are not in a new line of the block
# so we set the value of the array to be the previous value concatenated
# with the current line
[[ $s == 0 ]] && tests[$i]="${tests[$i]}"$'\n'"$line" || {
# Otherwise we are in the first line of the block, so we set the value
# of the array to the current line, and then we reset the flag (s) to zero
tests[$i]="$line"
s=0
}
done < /tmp/tmp-$KEY.txt
rm /tmp/tmp-$KEY.txt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.