github.com/la5nta/wl2k-go@v0.11.8/transport/ax25/tnc_test.go (about)

     1  // Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved.
     2  // Use of this source code is governed by the MIT-license that can be
     3  // found in the LICENSE file.
     4  
     5  package ax25
     6  
     7  import "testing"
     8  
     9  func TestTncAddrFromString(t *testing.T) {
    10  	tAddrParse(t, tncAddrFromString("LA5NTA-2 v LA1B-10"), "LA5NTA-2 via LA1B-10")
    11  	tAddrParse(t, tncAddrFromString("LA5NTA"), "LA5NTA")
    12  }
    13  
    14  func tAddrParse(t *testing.T, a tncAddr, expect string) {
    15  	ax25Addr := AX25Addr{a}
    16  	if ax25Addr.String() != expect {
    17  		t.Errorf("Expected '%s', got '%s'.", expect, ax25Addr)
    18  	}
    19  }