]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: fixing assert that creates warning: comparison between signed and unsigned... 14794/head
authorJos Collin <jcollin@redhat.com>
Wed, 26 Apr 2017 02:40:41 +0000 (08:10 +0530)
committerJos Collin <jcollin@redhat.com>
Thu, 27 Apr 2017 00:46:26 +0000 (06:16 +0530)
This fixes the additional comments in the PR: https://github.com/ceph/ceph/pull/14705
Fixed the review comments too.

Signed-off-by: Jos Collin <jcollin@redhat.com>
src/test/simple_spin.cc

index 6857a51ef366fcf53b753c3f938d9aa1242ac238..04b4fc07e5f6b6033d0196ac6ab16f6eca571d03 100644 (file)
@@ -33,21 +33,19 @@ TEST(SimpleSpin, Test1)
   pthread_t thread1;
   pthread_t thread2;
   ret = pthread_create(&thread1, NULL, mythread, NULL);
-  ASSERT_EQ(ret, 0);
+  ASSERT_EQ(0, ret);
   ret = pthread_create(&thread2, NULL, mythread, NULL);
-  ASSERT_EQ(ret, 0);
+  ASSERT_EQ(0, ret);
   ret = pthread_join(thread1, NULL);
-  ASSERT_EQ(ret, 0);
+  ASSERT_EQ(0, ret);
   ret = pthread_join(thread2, NULL);
-  ASSERT_EQ(ret, 0);
-  ASSERT_EQ(counter, n);
+  ASSERT_EQ(0, ret);
+  ASSERT_EQ(n, counter);
 
 
   // Should also work with pass-by-reference:
   // (Note that we don't care about cross-threading here as-such.)
   counter = 0;
-  uint32_t urhs = 0;
-  ASSERT_EQ(counter, urhs);
   async(std::launch::async, []() {
         for(int i = 0; n != i; ++i) {
             simple_spin_lock(lock);
@@ -55,6 +53,6 @@ TEST(SimpleSpin, Test1)
             simple_spin_unlock(lock);
         }
        });
-  ASSERT_EQ(counter, n);
+  ASSERT_EQ(n, counter);
 }