github.com/tursom/GoCollections@v0.3.10/util/Reference_test.go (about)

     1  /*
     2   * Copyright (c) 2022 tursom. All rights reserved.
     3   * Use of this source code is governed by a GPL-3
     4   * license that can be found in the LICENSE file.
     5   */
     6  
     7  package util
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/tursom/GoCollections/lang"
    13  )
    14  
    15  func TestStrongReference_Equals(t *testing.T) {
    16  	type fields struct {
    17  		reference int
    18  	}
    19  	type args struct {
    20  		o lang.Object
    21  	}
    22  	tests := []struct {
    23  		name   string
    24  		fields fields
    25  		args   args
    26  		want   bool
    27  	}{
    28  		{"1", fields{1}, args{NewStrongReference[int](1)}, true},
    29  	}
    30  	for _, tt := range tests {
    31  		t.Run(tt.name, func(t *testing.T) {
    32  			r := &StrongReference[int]{
    33  				reference: tt.fields.reference,
    34  			}
    35  			if got := r.Equals(tt.args.o); got != tt.want {
    36  				t.Errorf("Equals() = %v, want %v", got, tt.want)
    37  			}
    38  		})
    39  	}
    40  }