Last active
August 22, 2016 18:21
-
-
Save morxa/2db366b6f5797c0190383ce6d7c0f22a to your computer and use it in GitHub Desktop.
test generator
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
#!/bin/bash | |
# Copyright 2016 Till Hofmann <[email protected]> | |
# This work is free. You can redistribute it and/or modify it under the | |
# terms of the Do What The Fuck You Want To Public License, Version 2, | |
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. | |
random_word () { | |
ALL_NON_RANDOM_WORDS=/usr/share/dict/words | |
non_random_words=`cat $ALL_NON_RANDOM_WORDS | wc -l` | |
random_number=$(expr $non_random_words \* $RANDOM / 32767) | |
sed `echo $random_number`"q;d" $ALL_NON_RANDOM_WORDS | |
} | |
for i in $(seq 1 $1); do | |
w1=`random_word` | |
for j in $(seq 1 $2); do | |
w2=`random_word` | |
w3=`random_word` | |
echo "TEST(${w1^}Test,${w2^}${w3^}) {" | tr -d '-' >> test.cc | |
r=$RANDOM | |
echo " ASSERT_EQ($r,$r);" >> test.cc | |
echo "}" >> test.cc | |
echo >> test.cc | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment