Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

output.bats 782B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bats
  2. @test "Check that we have a debug output" {
  3. run stat "$BATS_TEST_DIRNAME/../target/debug/task5"
  4. [ "$status" -eq 0 ]
  5. }
  6. @test "Output must be from 1..30 and correct formated" {
  7. run "$BATS_TEST_DIRNAME/../target/debug/task5"
  8. [[ "${lines[0]}" =~ "1" ]]
  9. [[ "${lines[1]}" =~ "2*" ]]
  10. [[ "${lines[2]}" =~ "3*" ]]
  11. [[ "${lines[3]}" =~ "4" ]]
  12. [[ "${lines[4]}" =~ "5" ]]
  13. [[ "${lines[25]}" =~ "26" ]]
  14. [[ "${lines[26]}" =~ "27" ]]
  15. [[ "${lines[27]}" =~ "28" ]]
  16. [[ "${lines[28]}" =~ "29*" ]]
  17. [[ "${lines[29]}" =~ "30" ]]
  18. }
  19. # wc output with white spaces is trimmed by xargs
  20. @test "Output must be exact 30 lines long" {
  21. run bash -c "'$BATS_TEST_DIRNAME/../target/debug/task5' | wc -l | xargs"
  22. [ "$output" = "30" ]
  23. }