File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ class template_repo_base {
3737 void add_reset_entry (value_storage *entry) {
3838 reset_entries_.push_back (entry);
3939 }
40+ #ifdef TESTING_TEMPLATE_REPO_BASE
41+ public:
42+ #endif
4043 void add_vector_entry (value_storage *entry) {
4144 if (dictionary_alloc_)
4245 vector_entries_.push_back (entry);
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ add_executable (mfast_test
6161 aggregate_view_test.cpp
6262 simple_coder_test.cpp
6363 scp_reset_test.cpp
64+ template_repo_base.cpp
6465 )
6566
6667target_link_libraries (mfast_test
Original file line number Diff line number Diff line change 1+ #include " catch.hpp"
2+
3+ #define TESTING_TEMPLATE_REPO_BASE
4+ #include < mfast/coder/common/template_repo.h>
5+ #include < mfast/value_storage.h>
6+ #include < mfast/malloc_allocator.h>
7+ #include < mfast/instructions/template_instruction.h>
8+ #include < mfast/coder/common/dictionary_builder.h>
9+
10+ class template_repo_base_impl : public mfast ::template_repo_base
11+ {
12+ public:
13+ template_repo_base_impl (mfast::allocator *dictionary_alloc)
14+ : mfast::template_repo_base(dictionary_alloc) {}
15+
16+ virtual mfast::template_instruction *get_template (uint32_t )
17+ {
18+ return nullptr ;
19+ }
20+ };
21+
22+ TEST_CASE (" Test template repo base with repeated pointers" ," [test_template_repo_base]" )
23+ {
24+ using namespace mfast ;
25+
26+ value_storage* storage_1_ = new value_storage ();
27+ {
28+ const char * test_data = " Test_Data" ;
29+ storage_1_->of_array .len_ = static_cast <uint32_t >(std::strlen (test_data) + 1 );
30+ storage_1_->of_array .content_ = malloc_allocator::instance ()->allocate (storage_1_->of_array .len_ );
31+ storage_1_->of_array .capacity_in_bytes_ = 9 ;
32+ }
33+
34+ {
35+ template_repo_base_impl templ_repo (malloc_allocator::instance ());
36+ templ_repo.add_vector_entry (storage_1_);
37+ templ_repo.add_vector_entry (storage_1_);
38+ }
39+
40+ delete storage_1_;
41+ }
You can’t perform that action at this time.
0 commit comments