#!/bin/bash

if ! test -f /var/tmp/jat/rebooted; then

    jat__cmp 0 eq 1

    jat__pstarts init
        jat__cmp -h "math works" \
            0 eq 0
    jat__pend

    jat__pstartt
        jat__cmd true
        jat__cmd false
        jat__cmd -e 1 true
        jat__cmd -e 1 false
        jat__cmp 5 eq 3
        jat__cmp 5 gt 3
        jat__cmp foo re oo
        jat__cmp foo re '.*oo'
        jat__pass -h "so it looks fine"
        jat__fail -h "it still looks fine"
        jat__fail
        jat__pass
        jat__log_info "this is normal"
    jat__pend

    jat__pstartt beidz
        jat__cmd -b foo true
        jat__cmd -b foo2 false
    jat__pend

    jat__pstartt pre-reboot
        jat__cmd true
        touch /var/tmp/jat/rebooted
    jat__pend

    jat__log_info "rebooting"
    exit

else

    jat__log_info "rebooted"
    jat__pstartt post-reboot
        rm /var/tmp/jat/rebooted
        jat__cmd true
    jat__pend

fi

# jat__pstartt "torture"
#     jat__cmd
#     jat__cmd -z zaza
#     jat__cmp foo bar baz
#     jat__cmp foo eq baz
#     jat__fail "heya"
#     jat__pass "hoya"
#     jat__log_error "this is not normal"
# jat__pend