1#!/bin/bash
2TEST_DIR="$(dirname "${BASH_SOURCE[0]}")"
3source "$TEST_DIR"/test_lib.sh
4
5TestNormalizeMACInvalidArgs() {
6  ! "$NORMALIZE_MAC"
7  ! "$NORMALIZE_MAC" '0:0:0:0:0:0' 'extra'
8}
9
10TestNormalizeMACBadMAC() {
11  ! "$NORMALIZE_MAC" '0:0'
12  ! "$NORMALIZE_MAC" '0:0:0:0:0:0:0'
13  ! "$NORMALIZE_MAC" '1ff:0:0:0:0'
14}
15
16TestNormalizeMACSuccess() {
17  StrEq "$("$NORMALIZE_MAC" '0:0:0:0:0:0')" '00:00:00:00:00:00'
18  StrEq "$("$NORMALIZE_MAC" 'ff:0f:0:0:11:1')" 'ff:0f:00:00:11:01'
19  StrEq "$("$NORMALIZE_MAC" '0:0:0:0:0:ff')" "$("$NORMALIZE_MAC" '0:0:0:0:0:FF')"
20}
21
22TESTS+=(
23  TestNormalizeMACInvalidArgs
24  TestNormalizeMACBadMAC
25  TestNormalizeMACSuccess
26)
27
28return 0 2>/dev/null
29TestAnythingMain
30