#!/bin/sh
set -e

echo "Testing basic rtl_wmbus options with empty input"

# Test invalid option handling - should fail gracefully
if rtl_wmbus -z 2>&1 | grep -qi "usage"; then
    echo "PASS: Invalid option shows usage"
else
    echo "FAIL: Invalid option does not show usage"
    exit 1
fi

# Test that binary exists and is executable
if command -v rtl_wmbus >/dev/null 2>&1; then
    echo "PASS: rtl_wmbus binary is in PATH and executable"
else
    echo "FAIL: rtl_wmbus binary not found in PATH"
    exit 1
fi

# Test that we can check the version programmatically
VERSION=$(rtl_wmbus -V 2>&1 | head -n1)
if [ -n "$VERSION" ]; then
    echo "PASS: Version string retrieved: $VERSION"
else
    echo "FAIL: Could not retrieve version"
    exit 1
fi
