Coverage for /Syzygy/common/comparable_unittest.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%18180.C++test

Line-by-line coverage:

   1    :  // Copyright 2014 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #include "syzygy/common/comparable.h"
  16    :  
  17    :  #include "gtest/gtest.h"
  18    :  
  19    :  namespace common {
  20    :  
  21    :  namespace {
  22    :  
  23    :  struct TestComparable : public Comparable<TestComparable> {
  24    :   public:
  25  E :    explicit TestComparable(size_t value) : val(value) {
  26  E :    }
  27    :  
  28  E :    int Compare(const TestComparable& other) const {
  29  E :      return val - other.val;
  30  E :    }
  31    :  
  32    :    size_t val;
  33    :  };
  34    :  
  35    :  }  // namespace
  36    :  
  37  E :  TEST(ComparableTest, Operators) {
  38  E :    TestComparable one(1);
  39  E :    TestComparable one_copy(1);
  40  E :    TestComparable two(2);
  41  E :    EXPECT_EQ(one, one_copy);
  42  E :    EXPECT_NE(one, two);
  43  E :    EXPECT_LE(one, one_copy);
  44  E :    EXPECT_LE(one, two);
  45  E :    EXPECT_LT(one, two);
  46  E :    EXPECT_GE(one, one_copy);
  47  E :    EXPECT_GE(two, one);
  48  E :    EXPECT_GT(two, one);
  49  E :  }
  50    :  
  51    :  }  // namespace common

Coverage information generated Thu Jan 14 17:40:38 2016.