package dict import ( "reflect" "testing" ) func TestCopy(t *testing.T) { originalDict, err := LoadYaml("test_data/dict2.yaml") if err != nil { t.Fatalf("LoadYaml() returned an error: %v", err) } newDict1 := Dict{} Copy(&newDict1, originalDict) if !reflect.DeepEqual(newDict1, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict1) } newDict2 := make(Dict) Copy(&newDict2, originalDict) if !reflect.DeepEqual(newDict2, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict2) } var newDict3 Dict Copy(&newDict3, originalDict) if !reflect.DeepEqual(newDict3, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict3) } } func TestCopyFrom(t *testing.T) { originalDict, err := LoadYaml("test_data/dict2.yaml") if err != nil { t.Fatalf("LoadYaml() returned an error: %v", err) } newDict1 := Dict{} newDict1.CopyFrom(originalDict) if !reflect.DeepEqual(newDict1, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict1) } newDict2 := make(Dict) newDict2.CopyFrom(originalDict) if !reflect.DeepEqual(newDict2, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict2) } var newDict3 Dict newDict3.CopyFrom(originalDict) if !reflect.DeepEqual(newDict3, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict3) } } func TestCopyTo(t *testing.T) { originalDict, err := LoadYaml("test_data/dict2.yaml") if err != nil { t.Fatalf("LoadYaml() returned an error: %v", err) } newDict1 := Dict{} originalDict.CopyTo(&newDict1) if !reflect.DeepEqual(newDict1, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict1) } newDict2 := make(Dict) originalDict.CopyTo(&newDict2) if !reflect.DeepEqual(newDict2, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict2) } var newDict3 Dict originalDict.CopyTo(&newDict3) if !reflect.DeepEqual(newDict3, originalDict) { t.Errorf("Expected dict to be %v, got %v", originalDict, newDict3) } }