#!/usr/bin/env bash

set -xuo pipefail

function assert_exit_code() {
  set -e
  actual="$1"
  expected="$2"
  test "$actual" -eq "$expected"
  set +e
}

target="$1"

"base/main/test_$target" -exit_code=0
assert_exit_code $? 0

"base/main/test_$target" -exit_code=1
assert_exit_code $? 1

"base/main/test_$target" -exit_code=2
assert_exit_code $? 2
