#!/bin/bash RED="\e[31m" GREEN="\e[32m" YELLOW="\e[33m" NORMAL="\e[0;39m" OK=0 DIFF=0 echo -e "${YELLOW}--------------------------------------------------${NORMAL}" echo -e "${YELLOW}running the blogic examples and test cases${NORMAL}" echo -e "${YELLOW}using eye v$(eye --version 2>&1 | grep EYE | awk '{ print substr($2,2) }') and swipl v$(swipl --version 2>&1 | awk '{ print $3 }')${NORMAL}" echo -e "${YELLOW}--------------------------------------------------${NORMAL}" echo "" pad () { [ "$#" -gt 1 ] [ -n "$2" ] printf "%$2.${2#-}s" "$1" } begin=$(($(date +%s))) for file in input/*.n3 do f="$(basename ${file})" echo -en "$(pad "${f}" -34)" start=$EPOCHREALTIME eye --quiet --skolem-genid 8b98b360-9a70-4845-b52c-c675af60ad01 --nope ${file} --output output/${f} end=$EPOCHREALTIME echo -en "${YELLOW}$(pad "$(awk -v s="$start" -v e="$end" 'BEGIN{printf "%.0f", (e-s)*1000}') ms" 10)${NORMAL} " if [[ $(git diff output/${f} | wc -l) -eq 0 ]]; then echo -e "${GREEN}OK${NORMAL}" ((OK++)) else echo -e "${RED}DIFF${NORMAL}" ((DIFF++)) fi done end=$(($(date +%s))) echo "" echo -e "${YELLOW}`expr $end - $begin` sec${NORMAL} ${GREEN}${OK} OK${NORMAL} ${RED}${DIFF} DIFF${NORMAL}" if [[ ${DIFF} -eq 0 ]]; then exit 0 else exit 2 fi