|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Symbols that enter a Huffman encoder when memory runs out. More...
#include <gtest/gtest.h>#include "allocation_failure.H"#include <algorithm>#include <iterator>#include <new>#include <string>#include <utility>#include <vector>#include <Huffman.H>Go to the source code of this file.
Functions | |
| TEST_F (HuffmanWithoutMemory, SetFreqLeavesTheEncoderAsItWas) | |
| TEST_F (HuffmanWithoutMemory, SetEndOfStreamLeavesTheEncoderAsItWas) | |
| TEST_F (HuffmanWithoutMemory, GenerateLeavesTheEncoderAsItWas) | |
| TEST_F (HuffmanWithoutMemory, AFailedGenerationTakesMoreSymbols) | |
| TEST_F (HuffmanWithoutMemory, OneSymbolGeneratesItsLeaf) | |
| TEST_F (HuffmanWithoutMemory, AFailedGenerationKeepsNoFrequencyOfItsOwn) | |
Variables | |
| char | abc_input [] = "abracadabra, a cab" |
Symbols that enter a Huffman encoder when memory runs out.
This program replaces the global operator new, so that a test can make one allocation fail. set_freq() and set_end_of_stream(), as read_input() for each new symbol, make the leaf of the symbol and its node, and enter the node in the map of the symbols and in the heap. The node entered the heap first: without memory for the map, the leaf was freed while the heap kept the node, so the tree had a freed leaf, and the destructor freed it again.
Definition in file huffman_allocation_test.cc.
| TEST_F | ( | HuffmanWithoutMemory | , |
| AFailedGenerationKeepsNoFrequencyOfItsOwn | |||
| ) |
Definition at line 386 of file huffman_allocation_test.cc.
References abc_input, Aleph::and, Aleph::destroyRec(), Aleph::Huffman_Encoder_Engine::get_end_of_stream(), Aleph::Huffman_Encoder_Engine::get_freq_root(), Aleph::Huffman_Encoder_Engine::get_root(), k, and Aleph::Huffman_Encoder_Engine::read_input().
| TEST_F | ( | HuffmanWithoutMemory | , |
| AFailedGenerationTakesMoreSymbols | |||
| ) |
Definition at line 280 of file huffman_allocation_test.cc.
References Aleph::destroyRec(), Aleph::fill(), Aleph::Huffman_Encoder_Engine::generate_huffman_tree(), Aleph::Huffman_Encoder_Engine::get_root(), k, and Aleph::Huffman_Encoder_Engine::set_freq().
| TEST_F | ( | HuffmanWithoutMemory | , |
| GenerateLeavesTheEncoderAsItWas | |||
| ) |
Definition at line 214 of file huffman_allocation_test.cc.
References Aleph::destroyRec(), Aleph::fill(), Aleph::Huffman_Encoder_Engine::generate_huffman_tree(), Aleph::Huffman_Encoder_Engine::get_freq_root(), Aleph::Huffman_Encoder_Engine::get_root(), k, and Aleph::Huffman_Encoder_Engine::set_freq().
| TEST_F | ( | HuffmanWithoutMemory | , |
| OneSymbolGeneratesItsLeaf | |||
| ) |
Definition at line 333 of file huffman_allocation_test.cc.
References Aleph::destroyRec(), Aleph::Huffman_Encoder_Engine::generate_huffman_tree(), Aleph::Huffman_Encoder_Engine::get_freq_root(), Aleph::BinNode< Key >::get_key(), Aleph::Huffman_Encoder_Engine::get_root(), k, LLINK, RLINK, root(), and Aleph::Huffman_Encoder_Engine::set_freq().
| TEST_F | ( | HuffmanWithoutMemory | , |
| SetEndOfStreamLeavesTheEncoderAsItWas | |||
| ) |
Definition at line 129 of file huffman_allocation_test.cc.
References Aleph::Huffman_Encoder_Engine::set_end_of_stream().
| TEST_F | ( | HuffmanWithoutMemory | , |
| SetFreqLeavesTheEncoderAsItWas | |||
| ) |
Definition at line 121 of file huffman_allocation_test.cc.
References Aleph::Huffman_Encoder_Engine::set_freq().
| char abc_input[] = "abracadabra, a cab" |
Definition at line 384 of file huffman_allocation_test.cc.
Referenced by TEST_F().