LCOV - code coverage report
Current view: top level - test/unittests/zone - segmentpool-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 12 12 100.0 %
Date: 2019-01-20 Functions: 4 5 80.0 %

          Line data    Source code
       1             : // Copyright 2016 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/zone/accounting-allocator.h"
       6             : #include "testing/gtest/include/gtest/gtest.h"
       7             : 
       8             : namespace v8 {
       9             : namespace internal {
      10             : 
      11       15128 : TEST(Zone, SegmentPoolConstraints) {
      12             :   size_t sizes[]{
      13             :       0,  // Corner case
      14             :       AccountingAllocator::kMaxPoolSize,
      15             :       GB  // Something really large
      16           1 :   };
      17             : 
      18           1 :   AccountingAllocator allocator;
      19           4 :   for (size_t size : sizes) {
      20           3 :     allocator.ConfigureSegmentPool(size);
      21           3 :     size_t total_size = 0;
      22          21 :     for (size_t power = 0; power < AccountingAllocator::kNumberBuckets;
      23             :          ++power) {
      24             :       total_size +=
      25          18 :           allocator.unused_segments_max_sizes_[power] * (size_t(1) << power);
      26             :     }
      27           3 :     EXPECT_LE(total_size, size);
      28           1 :   }
      29           1 : }
      30             : 
      31             : }  // namespace internal
      32        9075 : }  // namespace v8

Generated by: LCOV version 1.10