mirror of https://github.com/on4kjm/FLEcli.git
parent
dd96badddb
commit
566482744f
|
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# the file is assumed to be run from the root of the project (test data location)
|
||||
|
||||
@test "Does the version show?" {
|
||||
output=$(docker run --rm on4kjm/flecli:latest version -d)
|
||||
echo 'status:' $status
|
||||
echo 'output:' $output
|
||||
}
|
||||
|
||||
|
||||
@test "Can a simple file be loaded?" {
|
||||
output=$(test/docker-FLEcli.sh load -i test/data/fle-1.txt)
|
||||
echo 'status:' $status
|
||||
echo 'output:' $output
|
||||
}
|
||||
|
||||
|
||||
@test "Can a more complex file be loaded?" {
|
||||
output=$(test/docker-FLEcli.sh load -i test/data/ON4KJM@ONFF-025920200524.txt)
|
||||
echo 'status:' $status
|
||||
echo 'output:' $output
|
||||
}
|
||||
|
||||
@test "Is the generated SOTA csv equivalent to the canonical one?" {
|
||||
mkdir -p test/output/temp
|
||||
output=$(test/docker-FLEcli.sh csv -o -i test/FLE-sample/sota_wwff.txt test/output/temp/sota_wwff.csv)
|
||||
echo 'status:' $status
|
||||
echo 'output:' $output
|
||||
diff test/output/temp/sota_wwff.csv test/FLE-sample/sota_wwff.csv --strip-trailing-cr
|
||||
}
|
||||
|
||||
@test "Processing a FLE file with no QSO must fail!" {
|
||||
run test/docker-FLEcli.sh csv -o -i test/data/fle-4-no-qso.txt
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "Processing a FLE file with parsing errors must fail!" {
|
||||
run test/docker-FLEcli.sh csv -o -i test/data/fle-5-wrong-call.txt
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURRENT_UID=$(id -u):$(id -g)
|
||||
docker run --rm -ti --user $(CURRENT_UID) -v $(pwd):/FLEcli_data jmmeessen/flecli "$@"
|
||||
docker run --rm -t --user ${CURRENT_UID} -v $(pwd):/FLEcli_data on4kjm/flecli:latest "$@"
|
||||
|
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
CURRENT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
TMP_DIR=${TMP_DIR:-/tmp}
|
||||
|
||||
## Cleanup
|
||||
rm -rf "${CURRENT_DIR}/bats" "${TMP_DIR}/bats-core"
|
||||
|
||||
## Prepare
|
||||
mkdir -p "${CURRENT_DIR}/helpers"
|
||||
|
||||
cat >"${CURRENT_DIR}/helpers/load.bash" <<EOF
|
||||
#!/bin/bats
|
||||
load "\${BATS_HELPERS_DIR}/bats-support/load.bash"
|
||||
load "\${BATS_HELPERS_DIR}/bats-assert/load.bash"
|
||||
load "\${BATS_HELPERS_DIR}/bats-file/load.bash"
|
||||
load "\${BATS_HELPERS_DIR}/helpers.bash"
|
||||
EOF
|
||||
|
||||
## Install bats from https://github.com/bats-core/bats-core
|
||||
git clone https://github.com/bats-core/bats-core.git "${TMP_DIR}/bats-core"
|
||||
bash "${TMP_DIR}/bats-core/install.sh" "${CURRENT_DIR}/bats"
|
||||
|
||||
## Install bats helper libraries from https://github.com/ztombol/bats-docs
|
||||
for BATS_HELPER in bats-support bats-assert bats-file
|
||||
do
|
||||
git clone "https://github.com/ztombol/${BATS_HELPER}" "${CURRENT_DIR}/helpers/${BATS_HELPER}"
|
||||
rm -rf "${CURRENT_DIR}/helpers/${BATS_HELPER}/.git" # No git tracking
|
||||
done
|
Loading…
Reference in new issue