Last active
October 19, 2021 23:18
-
-
Save mengcz13/817e681f7834c34175b6b66dbd6dc2fc to your computer and use it in GitHub Desktop.
cs103l_fall21_lab5test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COLOR='\033[0;32m' | |
NC='\033[0m' # No Color | |
printf '6\ncs103 trojan\nmidterm\naced\nperfect\nscore\n' > wordbank.txt | |
echo -e "${COLOR}-----use the provided wordbank file, allowing demo of correct guess (30 points)-----${NC}" | |
sed -i "s/int target = rand() % numWords;/int target = numWords - 1;/" scramble.cpp | |
g++ scramble.cpp -o scramble | |
./scramble wordbank.txt <<< "score" | |
echo "" | |
echo -e "${COLOR}-----allow TA/CP to create a wordbank containing 2 words, allowing demo of correct guess (20 points)-----${NC}" | |
printf "2\nsupercalifragilisticexpialidocious pseudohypoparathyroidism" >> ta_wordbank.txt | |
./scramble ta_wordbank.txt <<< "pseudohypoparathyroidism" | |
rm ta_wordbank.txt | |
echo "" | |
echo -e "${COLOR}-----demonstrate the correct handling of an input filename that DOES NOT exist (10 points - no partial credit)-----${NC}" | |
./scramble utopia.txt | |
echo "" | |
echo -e "${COLOR}-----demonstrate the correct handling of an input wordbank that DOES NOT contain a number (10 points - no partial credit)-----${NC}" | |
printf "supercalifragilisticexpialidocious pseudohypoparathyroidism" >> ta_wordbank.txt | |
./scramble ta_wordbank.txt <<< "pseudohypoparathyroidism" | |
rm ta_wordbank.txt | |
echo "" | |
echo -e "${COLOR}-----Test: memleak 1-----${NC}" | |
g++ memleak.cpp -o memleak | |
./memleak 1 | |
valgrind --tool=memcheck --leak-check=yes ./memleak 1 | |
echo "" | |
echo -e "${COLOR}-----Test: memleak 2-----${NC}" | |
./memleak 2 <<< "score" | |
valgrind --tool=memcheck --leak-check=yes ./memleak 2 <<< "score" | |
echo "" | |
echo -e "${COLOR}-----Test: scramble-----${NC}" | |
valgrind --tool=memcheck --leak-check=yes ./scramble wordbank.txt <<< "score" | |
echo "" | |
rm scramble | |
sed -i "s/int target = numWords - 1;/int target = rand() % numWords;/" scramble.cpp | |
rm memleak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment