Coverage for /Syzygy/pdb/pdb_mutator_unittest.cc

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

Line-by-line coverage:

   1    :  // Copyright 2013 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/pdb/pdb_mutator.h"
  16    :  
  17    :  #include "gmock/gmock.h"
  18    :  #include "gtest/gtest.h"
  19    :  
  20    :  namespace pdb {
  21    :  
  22    :  namespace {
  23    :  
  24    :  using testing::Return;
  25    :  
  26    :  class LenientMockPdbMutator : public PdbMutatorInterface {
  27    :   public:
  28  E :    virtual ~LenientMockPdbMutator() { }
  29  E :    virtual const char* name() const { return "MockPdbMutator"; }
  30    :  
  31  E :    MOCK_METHOD1(MutatePdb, bool(PdbFile*));
  32    :  };
  33    :  typedef testing::StrictMock<LenientMockPdbMutator>
  34    :      MockPdbMutator;
  35    :  
  36    :  class PdbMutatorTest : public testing::Test {
  37    :   public:
  38    :    PdbFile pdb_file_;
  39    :  };
  40    :  
  41    :  }  // namespace
  42    :  
  43  E :  TEST_F(PdbMutatorTest, ApplyMutatorsSucceeds) {
  44  E :    MockPdbMutator m1, m2, m3;
  45  E :    std::vector<PdbMutatorInterface*> mutators;
  46  E :    mutators.push_back(&m1);
  47  E :    mutators.push_back(&m2);
  48  E :    mutators.push_back(&m3);
  49    :  
  50  E :    EXPECT_CALL(m1, MutatePdb(&pdb_file_)).WillOnce(Return(true));
  51  E :    EXPECT_CALL(m2, MutatePdb(&pdb_file_)).WillOnce(Return(true));
  52  E :    EXPECT_CALL(m3, MutatePdb(&pdb_file_)).WillOnce(Return(true));
  53    :  
  54  E :    EXPECT_TRUE(ApplyPdbMutators(mutators, &pdb_file_));
  55  E :  }
  56    :  
  57  E :  TEST_F(PdbMutatorTest, ApplyMutatorsFails) {
  58  E :    MockPdbMutator m1, m2, m3;
  59  E :    std::vector<PdbMutatorInterface*> mutators;
  60  E :    mutators.push_back(&m1);
  61  E :    mutators.push_back(&m2);
  62  E :    mutators.push_back(&m3);
  63    :  
  64  E :    EXPECT_CALL(m1, MutatePdb(&pdb_file_)).WillOnce(Return(true));
  65  E :    EXPECT_CALL(m2, MutatePdb(&pdb_file_)).WillOnce(Return(false));
  66    :  
  67  E :    EXPECT_FALSE(ApplyPdbMutators(mutators, &pdb_file_));
  68  E :  }
  69    :  
  70    :  }  // namespace pdb

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