#!/bin/sh
# Round-trip the JS writer through the C reader. No Pebble SDK required — see
# pebble_stub.h for what is stubbed and what that does and does not prove.
set -eu
cd "$(dirname "$0")"

echo "--- generating a payload with the real JS writer ---"
node make-payload.js > /tmp/pebble-payload.hex
echo "--- compiling the C reader against the stub SDK ---"
cc -std=c11 -I. -Wall -Wextra -Wno-unused-parameter -Wno-unused-function \
   -o /tmp/wireformat_test wireformat_test.c
echo "--- decoding ---"
/tmp/wireformat_test < /tmp/pebble-payload.hex
