@@ -59,6 +59,24 @@ fn uint_xor() {
59
59
assert_eq ! ( x. load( SeqCst ) , 0xf731 ^ 0x137f ) ;
60
60
}
61
61
62
+ #[ test]
63
+ fn uint_min ( ) {
64
+ let x = AtomicUsize :: new ( 0xf731 ) ;
65
+ assert_eq ! ( x. fetch_min( 0x137f , SeqCst ) , 0xf731 ) ;
66
+ assert_eq ! ( x. load( SeqCst ) , 0x137f ) ;
67
+ assert_eq ! ( x. fetch_min( 0xf731 , SeqCst ) , 0x137f ) ;
68
+ assert_eq ! ( x. load( SeqCst ) , 0x137f ) ;
69
+ }
70
+
71
+ #[ test]
72
+ fn uint_max ( ) {
73
+ let x = AtomicUsize :: new ( 0x137f ) ;
74
+ assert_eq ! ( x. fetch_max( 0xf731 , SeqCst ) , 0x137f ) ;
75
+ assert_eq ! ( x. load( SeqCst ) , 0xf731 ) ;
76
+ assert_eq ! ( x. fetch_max( 0x137f , SeqCst ) , 0xf731 ) ;
77
+ assert_eq ! ( x. load( SeqCst ) , 0xf731 ) ;
78
+ }
79
+
62
80
#[ test]
63
81
fn int_and ( ) {
64
82
let x = AtomicIsize :: new ( 0xf731 ) ;
@@ -87,6 +105,24 @@ fn int_xor() {
87
105
assert_eq ! ( x. load( SeqCst ) , 0xf731 ^ 0x137f ) ;
88
106
}
89
107
108
+ #[ test]
109
+ fn int_min ( ) {
110
+ let x = AtomicIsize :: new ( 0xf731 ) ;
111
+ assert_eq ! ( x. fetch_min( 0x137f , SeqCst ) , 0xf731 ) ;
112
+ assert_eq ! ( x. load( SeqCst ) , 0x137f ) ;
113
+ assert_eq ! ( x. fetch_min( 0xf731 , SeqCst ) , 0x137f ) ;
114
+ assert_eq ! ( x. load( SeqCst ) , 0x137f ) ;
115
+ }
116
+
117
+ #[ test]
118
+ fn int_max ( ) {
119
+ let x = AtomicIsize :: new ( 0x137f ) ;
120
+ assert_eq ! ( x. fetch_max( 0xf731 , SeqCst ) , 0x137f ) ;
121
+ assert_eq ! ( x. load( SeqCst ) , 0xf731 ) ;
122
+ assert_eq ! ( x. fetch_max( 0x137f , SeqCst ) , 0xf731 ) ;
123
+ assert_eq ! ( x. load( SeqCst ) , 0xf731 ) ;
124
+ }
125
+
90
126
static S_FALSE : AtomicBool = AtomicBool :: new ( false ) ;
91
127
static S_TRUE : AtomicBool = AtomicBool :: new ( true ) ;
92
128
static S_INT : AtomicIsize = AtomicIsize :: new ( 0 ) ;
0 commit comments