blob: cb520efc10b8f5f51b64697da79c503883b73601 [file] [log] [blame]
William A. Kennington III7d6fa422021-02-08 17:04:02 -08001#!/bin/bash
2TEST_DIR="$(dirname "${BASH_SOURCE[0]}")"
3source "$TEST_DIR"/test_lib.sh
4
5TestNormalizeIPInvalidArgs() {
6 ! "$NORMALIZE_IP"
7 ! "$NORMALIZE_IP" '192.168.10.1' 'extra'
8}
9
10TestNormalizeIPBadIP() {
11 ! "$NORMALIZE_IP" '0f0.100.595.444'
12 ! "$NORMALIZE_IP" 'fx80::1'
13}
14
15TestNormalizeIPv4() {
16 StrEq "$("$NORMALIZE_IP" '192.168.10.1')" '192.168.10.1'
17 StrEq "$("$NORMALIZE_IP" '1.1.1.1')" '1.1.1.1'
18}
19
20TestNormalizeIPv6() {
21 StrEq "$("$NORMALIZE_IP" 'fe80:00B1::0000:1')" 'fe80:b1::1'
22}
23
24TESTS+=(
25 TestNormalizeIPInvalidArgs
26 TestNormalizeIPBadIP
27 TestNormalizeIPv4
28 TestNormalizeIPv6
29)
30
31return 0 2>/dev/null
32TestAnythingMain