Example #1
0
        public void TestAtomicInt32()
        {
            var d = AtomicFloat.From(10);

            Assert.Equal(10, d.Value);
            Assert.True(d.CompareExchange(20, 10));
            Assert.Equal(20, d.Value);
            Assert.True(d.Exchange(30));
            Assert.Equal(30, d.Value);
            Assert.Equal(30, (int)d);
        }
Example #2
0
        public void TestAtomicFloat()
        {
            var d = AtomicFloat.From(0.1f);

            Assert.Equal(0.1f, d.Value);
            Assert.True(d.CompareExchange(0.2f, 0.1f));
            Assert.Equal(0.2f, d.Value);
            Assert.True(d.Exchange(0.3f));
            Assert.Equal(0.3f, d.Value);
            Assert.Equal(0.3f, d);
        }