// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/tools/huffman_trie/huffman/huffman_builder.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace net::huffman_trie { namespace { // Test that there are no Huffman representations that are a prefix for another. TEST(HuffmanBuilderTest, NoPrefixCollision) { … } // Test that all recorded characters get a representation and that no other // representations are created. // Note: There is an exception for encodings with less than 2 unique inputs. TEST(HuffmanBuilderTest, NoMissingInputs) { … } // Test that the representations have optimal order by checking that characters // with higher counts get shorter (or equal length) representations than those // with lower counts. TEST(HuffmanBuilderTest, OptimalCodeOrder) { … } // Test that the ToVector() creates a byte vector that represents the expected // Huffman Tree. TEST(HuffmanBuilderTest, ToVector) { … } // The ToVector() logic requires at least 2 unique inputs to construct the // vector. Test that nodes are appended when there are less than 2 unique // inputs. TEST(HuffmanBuilderTest, ToVectorSingle) { … } } // namespace } // namespace net::huffman_trie