Skip to content

Instantly share code, notes, and snippets.

@cegme
Created February 18, 2019 05:11
Show Gist options
  • Save cegme/ae3e53f176dab3a7e46267eb430a578a to your computer and use it in GitHub Desktop.
Save cegme/ae3e53f176dab3a7e46267eb430a578a to your computer and use it in GitHub Desktop.
cs3113 spring 2019 example test case
dist: xenial
language: bash
before_install:
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
compiler:
- gcc
install:
- make clean
- make all
script:
- bats *bats
#!/usr/bin/env bats
TEST=`cat <<EOF
this is project 0 test case for oucat
EOF
`
TEST1=`cat <<EOF
EOF
`
TEST2=`cat <<EOF
this is project0
EOF
`
TEST3=`cat <<EOF
Test case for ouhead Project 0
EOF
`
TEST4=`cat <<EOF
}
EOF
`
TEST5=`cat <<EOF
7
EOF
`
TEST6=`cat <<EOF
3
4
5
6
7
EOF
`
TEST7=`cat <<EOF
19
EOF
`
@test "oucat" {
result="$(echo this is project 0 test case for oucat | ./oucat)"
[ "$result" = "$TEST" ]
}
@test "ouecho 1" {
result1="$(./ouecho)"
[ "$result1" = "$TEST1" ]
}
@test "ouecho 2" {
result2="$(./ouecho this is project0)"
[ "$result2" = "$TEST2" ]
}
@test "ouhead" {
result3="$(echo Test case for ouhead Project 0 | ./ouhead -n 1)"
[ "$result3" = "$TEST3" ]
}
@test "outail" {
result4="$(./outail -n 1 test_project0.bats)"
[ "$result4" = "$TEST4" ]
}
@test "ouseq 1" {
result5="$(./ouseq 7 7)"
[ "$result5" = "$TEST5" ]
}
@test "ouseq 2" {
result6="$(./ouseq 3 7)"
[ "$result6" = "$TEST6" ]
}
@test "ouwc" {
result7="$(echo test case for ouwc | ./ouwc -c)"
[ "$result7" = "$TEST7" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment