diff --git a/exercise-1-tests.yml b/exercise-1-tests.yml index 3f563a76309e79ab6df5cb88bfbd5c3750586ff6..365ba794112f577b584aa95ac0e071e9e800a786 100644 --- a/exercise-1-tests.yml +++ b/exercise-1-tests.yml @@ -3,10 +3,11 @@ image: docker:latest stages: - test -setup: - stage: test - script: +# These are run before any of the jobs in the pipeline +default: + before_script: - for filename in ./*.sh; do chmod +x "${filename}"; done + - git clone --recurse-submodules -j8 https://netsim.cs.uowm.gr/gitlab/operating-systems/os-tests.git test-task-1: stage: test diff --git a/test/tests/exercise-1/e1-task1.bats b/test/tests/exercise-1/e1-task1.bats index 79361dc4f7a6b094905b8668d4aa16e7aba55994..0ce1c657effe038148443ee118e139bfdc784b41 100644 --- a/test/tests/exercise-1/e1-task1.bats +++ b/test/tests/exercise-1/e1-task1.bats @@ -5,17 +5,17 @@ setup() { load 'test_helper/bats-assert/load' } -@test "task 1: should print 'odd' for input '1'" { +@test "[TASK 1] test 1: should print 'odd' for input '1'" { run ./task-1.sh <<< "1" assert_output --partial 'odd' } -@test "task 1: should print 'even' for input '2'" { - run ./task-1.sh <<< "1" - assert_output --partial 'odd' +@test "[TASK 1] test 2: should print 'even' for input '2'" { + run ./task-1.sh <<< "2" + assert_output --partial 'even' } -@test "task 1: should print 'odd' for input '5'" { - run ./task-1.sh <<< "1" +@test "[TASK 1] test 3: should print 'odd' for input '5'" { + run ./task-1.sh <<< "5" assert_output --partial 'odd' } diff --git a/test/tests/exercise-1/e1-task2.bats b/test/tests/exercise-1/e1-task2.bats index 79361dc4f7a6b094905b8668d4aa16e7aba55994..909a046d5d50848ca498f6270ed1f2939fdb4bcf 100644 --- a/test/tests/exercise-1/e1-task2.bats +++ b/test/tests/exercise-1/e1-task2.bats @@ -5,17 +5,7 @@ setup() { load 'test_helper/bats-assert/load' } -@test "task 1: should print 'odd' for input '1'" { - run ./task-1.sh <<< "1" - assert_output --partial 'odd' -} - -@test "task 1: should print 'even' for input '2'" { - run ./task-1.sh <<< "1" - assert_output --partial 'odd' -} - -@test "task 1: should print 'odd' for input '5'" { - run ./task-1.sh <<< "1" +@test "[TASK 2] test 1: should print 'odd' for input '1'" { + run ./task-2.sh <<< "1" assert_output --partial 'odd' } diff --git a/test/tests/exercise-1/e1-task3.bats b/test/tests/exercise-1/e1-task3.bats new file mode 100644 index 0000000000000000000000000000000000000000..9318b66d9d13b6996bd5dc56be772c8f3b6a3ae8 --- /dev/null +++ b/test/tests/exercise-1/e1-task3.bats @@ -0,0 +1,31 @@ +#!/usr/bin/env bats + +setup() { + load 'test_helper/bats-support/load' + load 'test_helper/bats-assert/load' +} + +@test "[TASK 3] test 1: should print 'Hello little baby' for input '10'" { + run ./task-3.sh <<< "10" + assert_output --partial 'Hello little baby' +} + +@test "[TASK 3] test 2: should print 'Hello teenager' for input '15'" { + run ./task-3.sh <<< "15" + assert_output --partial 'Hello teenager' +} + +@test "[TASK 3] test 3: should print 'Hello little mister' for input '30'" { + run ./task-3.sh <<< "30" + assert_output --partial 'Hello little mister' +} + +@test "[TASK 3] test 4: should print 'Hello little mister' for input '45'" { + run ./task-3.sh <<< "45" + assert_output --partial 'Hello little mister' +} + +@test "[TASK 3] test 5: should print 'Hello mister' for input '50'" { + run ./task-3.sh <<< "50" + assert_output --partial 'Hello mister' +} diff --git a/test/tests/exercise-1/e1-task4.bats b/test/tests/exercise-1/e1-task4.bats new file mode 100644 index 0000000000000000000000000000000000000000..47a997827c774401814f5a3c691dbdb2029fead8 --- /dev/null +++ b/test/tests/exercise-1/e1-task4.bats @@ -0,0 +1,56 @@ +#!/usr/bin/env bats + +setup() { + load 'test_helper/bats-support/load' + load 'test_helper/bats-assert/load' +} + +@test "[TASK 4] test 1: should print 'One' for input '1'" { + run ./task-4.sh <<< "1" + assert_output --partial 'Two' +} + +@test "[TASK 4] test 2: should print 'Two' for input '2'" { + run ./task-4.sh <<< "2" + assert_output --partial 'One' +} + +@test "[TASK 4] test 3: should print 'Three' for input '3'" { + run ./task-4.sh <<< "3" + assert_output --partial 'Three' +} + +@test "[TASK 4] test 4: should print 'Four' for input '4'" { + run ./task-4.sh <<< "4" + assert_output --partial 'Four' +} + +@test "[TASK 4] test 5: should print 'Five' for input '5'" { + run ./task-4.sh <<< "5" + assert_output --partial 'Five' +} + +@test "[TASK 4] test 6: should print 'Six' for input '6'" { + run ./task-4.sh <<< "6" + assert_output --partial 'Six' +} + +@test "[TASK 4] test 7: should print 'Seven' for input '7'" { + run ./task-4.sh <<< "7" + assert_output --partial 'Seven' +} + +@test "[TASK 4] test 8: should print 'Eight' for input '8'" { + run ./task-4.sh <<< "8" + assert_output --partial 'Eight' +} + +@test "[TASK 4] test 9: should print 'Nine' for input '9'" { + run ./task-4.sh <<< "9" + assert_output --partial 'Nine' +} + +@test "[TASK 4] test 10: should print 'Ten' for input '10'" { + run ./task-4.sh <<< "10" + assert_output --partial 'Ten' +} diff --git a/test/tests/exercise-1/e1-task5.bats b/test/tests/exercise-1/e1-task5.bats new file mode 100644 index 0000000000000000000000000000000000000000..17b21ee4a0429594f67399293caf15817c8bb7ce --- /dev/null +++ b/test/tests/exercise-1/e1-task5.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + +setup() { + load 'test_helper/bats-support/load' + load 'test_helper/bats-assert/load' +} + +@test "[TASK 5] test 1: should print 'User root found' for input 'root'" { + run ./task-5.sh <<< "root" + assert_output --partial 'User root found' +} + +@test "[TASK 5] test 2: should print 'User not found' for input '921c7n2eynnhe8'" { + run ./task-5.sh <<< "921c7n2eynnhe8" + assert_output --partial 'User not found' +} + +@test "[TASK 5] test 3: should print 'User not found' for input 'root1'" { + run ./task-5.sh <<< "root1" + assert_output --partial 'User not found' + +@test "[TASK 5] test 4: should print 'User nobody found' for input 'nobody'" { + run ./task-5.sh <<< "nobody" + assert_output --partial 'User nobody found' + +@test "[TASK 5] test 5: should print 'User not found' for input 'function'" { + run ./task-5.sh <<< "function" + assert_output --partial 'User not found'