@@ -59,6 +59,24 @@ fn uint_xor() {
5959 assert_eq ! ( x. load( SeqCst ) , 0xf731 ^ 0x137f ) ;
6060}
6161
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+
6280#[ test]
6381fn int_and ( ) {
6482 let x = AtomicIsize :: new ( 0xf731 ) ;
@@ -87,6 +105,24 @@ fn int_xor() {
87105 assert_eq ! ( x. load( SeqCst ) , 0xf731 ^ 0x137f ) ;
88106}
89107
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+
90126static S_FALSE : AtomicBool = AtomicBool :: new ( false ) ;
91127static S_TRUE : AtomicBool = AtomicBool :: new ( true ) ;
92128static S_INT : AtomicIsize = AtomicIsize :: new ( 0 ) ;
0 commit comments