github.com/tursom/GoCollections@v0.3.10/lang/atomic/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 atomic
     8  
     9  import (
    10  	"testing"
    11  )
    12  
    13  func TestAtomic_Store(t *testing.T) {
    14  	//a := NewReference[int](nil)
    15  	//var i = 1
    16  	//a.Store(&i)
    17  	//i = 2
    18  	//fmt.Println(*a.Load())
    19  }
    20  
    21  func TestReferenceOf(t *testing.T) {
    22  	//one := 1
    23  	//
    24  	//var p *int = nil
    25  	//ref := ReferenceOf(&p)
    26  	//
    27  	//ref.Store(&one)
    28  	//fmt.Println(ref.Load())
    29  	//fmt.Println(*ref.Load())
    30  	//
    31  	//_ = *ref.AsUintptr() + 1
    32  }