mirror of
https://github.com/tursom/GoCollections.git
synced 2025-03-13 17:00:18 +08:00
33 lines
544 B
Go
33 lines
544 B
Go
/*
|
|
* Copyright (c) 2022 tursom. All rights reserved.
|
|
* Use of this source code is governed by a GPL-3
|
|
* license that can be found in the LICENSE file.
|
|
*/
|
|
|
|
package atomic
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestAtomic_Store(t *testing.T) {
|
|
//a := NewReference[int](nil)
|
|
//var i = 1
|
|
//a.Store(&i)
|
|
//i = 2
|
|
//fmt.Println(*a.Load())
|
|
}
|
|
|
|
func TestReferenceOf(t *testing.T) {
|
|
//one := 1
|
|
//
|
|
//var p *int = nil
|
|
//ref := ReferenceOf(&p)
|
|
//
|
|
//ref.Store(&one)
|
|
//fmt.Println(ref.Load())
|
|
//fmt.Println(*ref.Load())
|
|
//
|
|
//_ = *ref.AsUintptr() + 1
|
|
}
|