#!/bin/bash

read-0() {
    while [ "$1" ]; do
        IFS=$'\0' read -r -d '' "$1" || return 1
        shift
    done
}

for file in *.yml
do
    cat ${file} | shyaml get-value when > test.s
    echo "bkpt" >> test.s
    arm-none-eabi-gcc -nostdlib -Ttext=0x0 -mcpu=cortex-m0 test.s -o test.elf > test.build 2>&1
    arm-none-eabi-objcopy test.elf -O binary test.bin >> test.build 2>&1
    cat ${file} | shyaml key-values given | ../src/core-test > test.output
    cat ${file} | shyaml key-values-0 then |
    	while read-0 key value; do
	    grep "${key} ${value}" test.output > /dev/null ||
		echo "FAILED:" $(shyaml get-value name ${file} < ${file})
	done
done

#!/bin/bash

read-0() {
    while [ "$1" ]; do
        IFS=$'\0' read -r -d '' "$1" || return 1
        shift
    done
}

for file in *.yml
do
    base=$(basename $file .yml)
    cat ${file} | shyaml get-value when > ${base}.s
    echo "bkpt" >> ${base}.s
    arm-none-eabi-gcc -nostdlib -Ttext=0x0 -mcpu=cortex-m0 ${base}.s -o ${base}.elf > ${base}.build 2>&1
    arm-none-eabi-objcopy ${base}.elf -O binary test.bin >> ${base}.build 2>&1
    cat ${file} | shyaml key-values given | ../src/core-test > ${base}.output
    cat ${file} | shyaml key-values-0 then |
    	while read-0 key value; do
	    grep "${key} ${value}" ${base}.output > /dev/null ||
	        echo "FAILED:" $(shyaml get-value name ${file} < ${file})
	done
done

Use separate names for each test out file.
Use separate names for each test out file.

Create files based on the YAML filename, so that the files don't get
overwritten.
