blob: 644e6e23520a76bdfe6ec6e1ea9ad00d40947dc1 [file] [log] [blame]
Stephane Barbarie694e2b92018-09-07 12:17:36 -04001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Stephane Barbarieec0919b2018-09-05 14:14:29 -040016package model
17
18import (
19 "testing"
20 "github.com/opencord/voltha-go/protos/voltha"
21 "reflect"
22)
23
24func Test_Utils_Clone(t *testing.T) {
25 a := &voltha.Device{
26 Id: "abcde",
27 FirmwareVersion: "someversion",
28 }
29 b:= &voltha.Device{}
30 Clone(reflect.ValueOf(a).Interface(), b)
31 t.Logf("A: %+v, B: %+v", a, b)
32 b.Id = "12345"
33 t.Logf("A: %+v, B: %+v", a, b)
34
35 var c *voltha.Device
36 c = Clone2(a).(*voltha.Device)
37 t.Logf("A: %+v, C: %+v", a, c)
38 c.Id = "12345"
39 t.Logf("A: %+v, C: %+v", a, c)
40}