JSON configs describe network and node MACs; scenarios run command sequences with expect checks. Share UART client API across CLI and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
534 B
Go
30 lines
534 B
Go
package autotest
|
|
|
|
import "testing"
|
|
|
|
func TestNewBenchClientIDFromMAC(t *testing.T) {
|
|
cfg := Config{
|
|
ID: "t",
|
|
Network: 1,
|
|
MasterMAC: "aa:bb:cc:dd:ee:ff",
|
|
Slaves: []SlaveNode{{
|
|
ID: "pod",
|
|
MAC: "50:78:7d:18:01:10",
|
|
}},
|
|
}
|
|
b, err := NewBench(cfg)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s, _ := b.Slave("pod")
|
|
if *s.ClientID != 16 {
|
|
t.Fatalf("client_id=%d want 16", *s.ClientID)
|
|
}
|
|
}
|
|
|
|
func TestMACEqual(t *testing.T) {
|
|
if !MACEqual("50:78:7D:18:01:10", "50-78-7d-18-01-10") {
|
|
t.Fatal("MACEqual failed")
|
|
}
|
|
}
|