#!/bin/bash

set -exu

# fast checks first
cargo fmt --check
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps

cargo build --no-default-features -q
cargo build --all-targets -q
cargo test -q
cargo clippy -- -Dwarnings

# ping example should work reliably for localhost
RUST_LOG=debug cargo run --example ping -- 127.0.0.1 -c 3
RUST_LOG=debug cargo run --example ping -- ::1 -c 3