#!/usr/bin/env bash

# test that rumur-ast-dump can parse a basic model

if [ -z "${AUTOPKGTEST_TMP}" ]; then
  printf 'AUTOPKGTEST_TMP not set; not running in autopkgtest?\n' >&2
  exit 1
fi

set -e
set -x

# move to temporary directory
mkdir -p ${AUTOPKGTEST_TMP}/rumur-ast-dump-model
cd ${AUTOPKGTEST_TMP}/rumur-ast-dump-model

# construct a simple model
cat - >model.m <<EOT
var
  x: boolean;

startstate begin
  x := true;
end;

rule begin
  x := !x;
end;
EOT

# parse the model
rumur-ast-dump --output /dev/null model.m
