1 // Copyright 2008 Google Inc. All Rights Reserved.
2 // Author: hamaji@google.com (Shinichiro Hamaji)
5 #include "googletest.h"
6 #include "glog/logging.h"
8 using namespace GOOGLE_NAMESPACE;
10 TEST(sync_val_compare_and_swap, utilities) {
11 bool now_entering = false;
12 EXPECT_FALSE(sync_val_compare_and_swap(&now_entering, false, true));
13 EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
14 EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
17 int main(int argc, char **argv) {
18 InitGoogleLogging(argv[0]);
19 InitGoogleTest(&argc, argv);
21 CHECK_EQ(RUN_ALL_TESTS(), 0);