#!/bin/sh
set -e

exec 3>&2
run() { echo "+ $*" >&3; "$@"; }

# Verify that BIGINT (int64_t) arithmetic is correct.
result=$(run duckdb -c "SELECT 9223372036854775807::BIGINT AS max_bigint;")
echo "$result" | grep -q "9223372036854775807"

# Test BIGINT storage/aggregation: range() always yields BIGINT values
# regardless of magnitude.
result=$(run duckdb -c "SELECT len(array_agg(i)) FROM range(1000000) t(i);")
echo "$result" | grep -q "1000000"
