2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
26 func TestPlmnId1(t *testing.T) {
28 var ident PlmnIdentity
29 ident.StringPut("23350")
31 if ident.Val[0] != 0x32 {
32 t.Errorf("TestPlmnId1: ident.val[0] expected 0x32 got 0x%x", ident.Val[0])
35 if ident.Val[1] != 0xf3 {
36 t.Errorf("TestPlmnId1: ident.val[1] expected 0xf3 got 0x%x", ident.Val[1])
39 if ident.Val[2] != 0x05 {
40 t.Errorf("TestPlmnId1: ident.val[2] expected 0x05 got 0x%x", ident.Val[2])
43 fullstr := ident.String()
44 if fullstr != "23350" {
45 t.Errorf("TestPlmnId2: fullstr expected 23350 got %s", fullstr)
48 mccstr := ident.MccString()
50 t.Errorf("TestPlmnId1: mcc expected 233 got %s", mccstr)
52 mncstr := ident.MncString()
54 t.Errorf("TestPlmnId1: mnc expected 50 got %s", mncstr)
58 func TestPlmnId2(t *testing.T) {
60 var ident PlmnIdentity
61 ident.StringPut("233550")
63 if ident.Val[0] != 0x32 {
64 t.Errorf("TestPlmnId1: ident.val[0] expected 0x32 got 0x%x", ident.Val[0])
67 if ident.Val[1] != 0x03 {
68 t.Errorf("TestPlmnId1: ident.val[1] expected 0x03 got 0x%x", ident.Val[1])
71 if ident.Val[2] != 0x55 {
72 t.Errorf("TestPlmnId1: ident.val[2] expected 0x55 got 0x%x", ident.Val[2])
75 fullstr := ident.String()
76 if fullstr != "233550" {
77 t.Errorf("TestPlmnId2: fullstr expected 233550 got %s", fullstr)
80 mccstr := ident.MccString()
82 t.Errorf("TestPlmnId2: mcc expected 233 got %s", mccstr)
84 mncstr := ident.MncString()
86 t.Errorf("TestPlmnId2: mnc expected 550 got %s", mncstr)