MCPcopy Create free account
hub / github.com/davisking/dlib / lz77_buffer_kernel_test

Function lz77_buffer_kernel_test

dlib/test/lz77_buffer.cpp:26–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 typename buf
25 >
26 void lz77_buffer_kernel_test (
27 )
28 /*!
29 requires
30 - buf is an implementation of lz77_buffer/lz77_buffer_kernel_abstract.h
31 ensures
32 - runs tests on buf for compliance with the specs
33 !*/
34 {
35 typedef dlib::sliding_buffer<unsigned char>::kernel_1a sbuf;
36
37 buf test(8,20);
38 srand(static_cast<unsigned int>(time(0)));
39
40 DLIB_TEST(test.get_lookahead_buffer_size() == 0);
41 DLIB_TEST(test.get_history_buffer_size() == 0);
42 DLIB_TEST_MSG(test.get_history_buffer_limit() == 256-20,test.get_history_buffer_limit());
43 DLIB_TEST(test.get_lookahead_buffer_limit() == 20);
44
45
46 for (int g = 0; g < 2; ++g)
47 {
48 test.clear();
49
50 for (int i = 0; i < 1000; ++i)
51 {
52 test.add('a');
53 }
54 DLIB_TEST(test.get_lookahead_buffer_size() == 20);
55
56
57 test.shift_buffers(5);
58
59 DLIB_TEST(test.get_lookahead_buffer_size() == 15);
60
61
62
63 unsigned long index, length, temp;
64 temp = test.get_lookahead_buffer_size();
65 test.find_match(index,length,5);
66
67
68 DLIB_TEST_MSG(length <= temp,
69 "length: " << length <<
70 "\ntemp: " << temp);
71 DLIB_TEST(test.get_lookahead_buffer_size() <= 15);
72
73
74 }
75
76
77 for (int g = 0; g < 2; ++g)
78 {
79
80
81
82 test.clear();
83

Callers

nothing calls this directly

Calls 15

rotate_leftMethod · 0.80
rotate_rightMethod · 0.80
randClass · 0.50
clearMethod · 0.45
addMethod · 0.45
shift_buffersMethod · 0.45
strMethod · 0.45
set_sizeMethod · 0.45

Tested by

no test coverage detected