chromium/third_party/openscreen/src/util/yet_another_bit_vector_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "util/yet_another_bit_vector.h"

#include <algorithm>

#include "gtest/gtest.h"
#include "platform/base/span.h"

namespace openscreen {
namespace {

constexpr uint8_t kBitPatterns[] =;

// These are used for testing various vector sizes, begins/ends of ranges, etc.
// They will exercise both the "inlined storage" (size <= 64 case) and
// "heap-allocated storage" cases. These are all of the prime numbers less than
// 100, and also any non-negative multiples of 64 less than 192.
const int kTestSizes[] =;

// Returns a subspan of |kTestSizes| that contains all values in the range
// [first,last].
Span<const int> GetTestSizesInRange(int first, int last) {}

// Returns true if an infinitely-repeating |pattern| has a bit set at the given
// |position|.
constexpr bool IsSetInPattern(uint8_t pattern, int position) {}

// Fills an infinitely-repeating |pattern| in |v|, but only modifies the bits at
// and after the given |from| position.
void FillWithPattern(uint8_t pattern, int from, YetAnotherBitVector* v) {}

// Tests that construction and resizes initialize the vector to the correct size
// and set or clear all of its bits, as requested.
TEST(YetAnotherBitVectorTest, ConstructsAndResizes) {}

// Tests that individual bits can be set and cleared for various vector sizes
// and bit patterns.
TEST(YetAnotherBitVectorTest, SetsAndClearsIndividualBits) {}

// Tests that the vector shifts its bits right by various amounts, for various
// vector sizes and bit patterns.
TEST(YetAnotherBitVectorTest, ShiftsRight) {}

// Tests the FindFirstSet() operation, for various vector sizes and bit
// patterns.
TEST(YetAnotherBitVectorTest, FindsTheFirstBitSet) {}

// Tests the CountBitsSet() operation, for various vector sizes, bit patterns,
// and ranges of bits being counted.
TEST(YetAnotherBitVector, CountsTheNumberOfBitsSet) {}

}  // namespace
}  // namespace openscreen