Coverage for /Syzygy/block_graph/block_util_unittest.cc

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

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc.
   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/block_graph/block_util.h"
  16    :  
  17    :  #include "gtest/gtest.h"
  18    :  
  19    :  namespace block_graph {
  20    :  
  21    :  namespace {
  22    :  
  23    :  class BlockUtilTest: public testing::Test {
  24    :   public:
  25  E :    void TestAttributes(BlockGraph::BlockAttributes attributes, bool expected) {
  26  E :      BlockGraph::Block* code = image_.AddBlock(BlockGraph::CODE_BLOCK, 40, "c");
  27  E :      code->set_attributes(attributes);
  28  E :      ASSERT_EQ(expected, CodeBlockAttributesAreBasicBlockSafe(code));
  29  E :    }
  30    :  
  31    :   private:
  32    :    BlockGraph image_;
  33    :  };
  34    :  
  35    :  }  // namespace
  36    :  
  37  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeGapBlock) {
  38  E :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::GAP_BLOCK, false));
  39  E :  }
  40    :  
  41  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafePaddingBlock) {
  42  E :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::PADDING_BLOCK, false));
  43  E :  }
  44    :  
  45  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeHasInlineAssembly) {
  46    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::HAS_INLINE_ASSEMBLY,
  47  E :                                           false));
  48  E :  }
  49    :  
  50  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeUnsupportedCompiler) {
  51    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(
  52  E :        BlockGraph::BUILT_BY_UNSUPPORTED_COMPILER, false));
  53  E :  }
  54    :  
  55  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeErroredDisassembly) {
  56    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::ERRORED_DISASSEMBLY,
  57  E :                                           false));
  58  E :  }
  59    :  
  60  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeExceptionHandling) {
  61    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::HAS_EXCEPTION_HANDLING,
  62  E :                                           false));
  63  E :  }
  64    :  
  65  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeDisassembledPastEnd) {
  66    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(BlockGraph::DISASSEMBLED_PAST_END,
  67  E :                                           false));
  68  E :  }
  69    :  
  70  E :  TEST_F(BlockUtilTest, CodeBlockAttributesAreBasicBlockSafeBuiltBySyzygy) {
  71    :    ASSERT_NO_FATAL_FAILURE(TestAttributes(
  72  E :        BlockGraph::HAS_INLINE_ASSEMBLY | BlockGraph::BUILT_BY_SYZYGY, true));
  73  E :  }
  74    :  
  75    :  }  // namespace block_graph

Coverage information generated Thu Sep 06 11:30:46 2012.