2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2015-01-30 14:56:03 -06:00
|
|
|
package dag
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBasicEdgeHashcode(t *testing.T) {
|
|
|
|
e1 := BasicEdge(1, 2)
|
|
|
|
e2 := BasicEdge(1, 2)
|
|
|
|
if e1.Hashcode() != e2.Hashcode() {
|
|
|
|
t.Fatalf("bad")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBasicEdgeHashcode_pointer(t *testing.T) {
|
|
|
|
type test struct {
|
|
|
|
Value string
|
|
|
|
}
|
|
|
|
|
|
|
|
v1, v2 := &test{"foo"}, &test{"bar"}
|
|
|
|
e1 := BasicEdge(v1, v2)
|
|
|
|
e2 := BasicEdge(v1, v2)
|
|
|
|
if e1.Hashcode() != e2.Hashcode() {
|
|
|
|
t.Fatalf("bad")
|
|
|
|
}
|
|
|
|
}
|