tests: Add MPLS + VLAN tests.
[sliver-openvswitch.git] / tests / test-atomic.c
index 27bf552..bc00df1 100644 (file)
         ovs_assert(orig == 2);                          \
         atomic_read(&x, &value);                        \
         ovs_assert(value == 8);                         \
+                                                        \
+        atomic_destroy(&x);                             \
     }
 
+static void
+test_atomic_flag(void)
+{
+    atomic_flag flag = ATOMIC_FLAG_INIT;
+    ovs_assert(atomic_flag_test_and_set(&flag) == false);
+    ovs_assert(atomic_flag_test_and_set(&flag) == true);
+    atomic_flag_clear(&flag);
+    ovs_assert(atomic_flag_test_and_set(&flag) == false);
+}
+
 int
 main(void)
 {
@@ -90,5 +102,7 @@ main(void)
     TEST_ATOMIC_TYPE(atomic_uint64_t, uint64_t);
     TEST_ATOMIC_TYPE(atomic_int64_t, int64_t);
 
+    test_atomic_flag();
+
     return 0;
 }