mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Fixed flat map index test.
Used ETL_ERROR macros for exceptions. Added new files to project.
This commit is contained in:
parent
90780391c9
commit
66eb540f5b
37
iflat_map.h
37
iflat_map.h
@ -223,10 +223,11 @@ namespace etl
|
||||
{
|
||||
iterator i_element = lower_bound(key);
|
||||
|
||||
if (i_element->first != key)
|
||||
if (i_element == end())
|
||||
{
|
||||
// Doesn't exist, so create a new one.
|
||||
i_element = insert(std::make_pair(key, mapped_type())).first;
|
||||
value_type value(key, mapped_type());
|
||||
i_element = insert(value).first;
|
||||
}
|
||||
|
||||
return i_element->second;
|
||||
@ -245,12 +246,7 @@ namespace etl
|
||||
if (i_element == end())
|
||||
{
|
||||
// Doesn't exist.
|
||||
#if ETL_THROW_EXCEPTIONS
|
||||
throw flat_map_out_of_bounds();
|
||||
#else
|
||||
error_handler::error(flat_map_out_of_bounds());
|
||||
|
||||
#endif
|
||||
ETL_ERROR(flat_map_out_of_bounds());
|
||||
}
|
||||
|
||||
return i_element->second;
|
||||
@ -269,12 +265,7 @@ namespace etl
|
||||
if (i_element == end())
|
||||
{
|
||||
// Doesn't exist.
|
||||
#if ETL_THROW_EXCEPTIONS
|
||||
throw flat_map_out_of_bounds();
|
||||
#else
|
||||
error_handler::error(flat_map_out_of_bounds());
|
||||
|
||||
#endif
|
||||
ETL_ERROR(flat_map_out_of_bounds());
|
||||
}
|
||||
|
||||
return i_element->second;
|
||||
@ -295,11 +286,7 @@ namespace etl
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
#ifdef ETL_THROW_EXCEPTIONS
|
||||
throw flat_map_iterator();
|
||||
#else
|
||||
error_handler::error(flat_map_iterator());
|
||||
#endif
|
||||
ETL_ERROR(flat_map_iterator());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -327,11 +314,7 @@ namespace etl
|
||||
// At the end.
|
||||
if (buffer.full())
|
||||
{
|
||||
#ifdef ETL_THROW_EXCEPTIONS
|
||||
throw flat_map_full();
|
||||
#else
|
||||
error_handler::error(flat_map_full());
|
||||
#endif
|
||||
ETL_ERROR(flat_map_full());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -356,11 +339,7 @@ namespace etl
|
||||
// A new one.
|
||||
if (buffer.full())
|
||||
{
|
||||
#ifdef ETL_THROW_EXCEPTIONS
|
||||
throw flat_map_full();
|
||||
#else
|
||||
error_handler::error(flat_map_full());
|
||||
#endif
|
||||
ETL_ERROR(flat_map_full());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@ class TestDataDC
|
||||
public:
|
||||
|
||||
TestDataDC()
|
||||
: value(T())
|
||||
{
|
||||
}
|
||||
|
||||
@ -82,6 +83,10 @@ class TestDataNDC
|
||||
{
|
||||
public:
|
||||
|
||||
TestDataNDC()
|
||||
: value(T())
|
||||
{}
|
||||
|
||||
TestDataNDC(const T& value)
|
||||
: value(value)
|
||||
{}
|
||||
|
||||
@ -228,16 +228,16 @@ namespace
|
||||
|
||||
DataNDC data(compare_data.begin(), compare_data.end());
|
||||
|
||||
//CHECK_EQUAL(data[0], compare_data[0]);
|
||||
//CHECK_EQUAL(data[1], compare_data[1]);
|
||||
//CHECK_EQUAL(data[2], compare_data[2]);
|
||||
//CHECK_EQUAL(data[3], compare_data[3]);
|
||||
//CHECK_EQUAL(data[4], compare_data[4]);
|
||||
//CHECK_EQUAL(data[5], compare_data[5]);
|
||||
//CHECK_EQUAL(data[6], compare_data[6]);
|
||||
//CHECK_EQUAL(data[7], compare_data[7]);
|
||||
//CHECK_EQUAL(data[8], compare_data[8]);
|
||||
//CHECK_EQUAL(data[9], compare_data[9]);
|
||||
CHECK_EQUAL(compare_data[0], data[0]);
|
||||
CHECK_EQUAL(compare_data[1], data[1]);
|
||||
CHECK_EQUAL(compare_data[2], data[2]);
|
||||
CHECK_EQUAL(compare_data[3], data[3]);
|
||||
CHECK_EQUAL(compare_data[4], data[4]);
|
||||
CHECK_EQUAL(compare_data[5], data[5]);
|
||||
CHECK_EQUAL(compare_data[6], data[6]);
|
||||
CHECK_EQUAL(compare_data[7], data[7]);
|
||||
CHECK_EQUAL(compare_data[8], data[8]);
|
||||
CHECK_EQUAL(compare_data[9], data[9]);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -122,6 +122,7 @@
|
||||
<ClInclude Include="..\..\binary.h" />
|
||||
<ClInclude Include="..\..\bitset.h" />
|
||||
<ClInclude Include="..\..\bloom_filter.h" />
|
||||
<ClInclude Include="..\..\bsd_checksum.h" />
|
||||
<ClInclude Include="..\..\checksum.h" />
|
||||
<ClInclude Include="..\..\crc16.h" />
|
||||
<ClInclude Include="..\..\crc16_ccitt.h" />
|
||||
@ -141,6 +142,8 @@
|
||||
<ClInclude Include="..\..\factorial.h" />
|
||||
<ClInclude Include="..\..\fibonacci.h" />
|
||||
<ClInclude Include="..\..\fixed_iterator.h" />
|
||||
<ClInclude Include="..\..\flat_multimap.h" />
|
||||
<ClInclude Include="..\..\flat_multimap_base.h" />
|
||||
<ClInclude Include="..\..\flat_set.h" />
|
||||
<ClInclude Include="..\..\flat_set_base.h" />
|
||||
<ClInclude Include="..\..\fnv_1.h" />
|
||||
@ -151,6 +154,7 @@
|
||||
<ClInclude Include="..\..\hash.h" />
|
||||
<ClInclude Include="..\..\ibitset.h" />
|
||||
<ClInclude Include="..\..\ideque.h" />
|
||||
<ClInclude Include="..\..\iflat_multimap.h" />
|
||||
<ClInclude Include="..\..\iflat_set.h" />
|
||||
<ClInclude Include="..\..\iforward_list.h" />
|
||||
<ClInclude Include="..\..\ihash.h" />
|
||||
@ -173,6 +177,7 @@
|
||||
<ClInclude Include="..\..\container.h" />
|
||||
<ClInclude Include="..\..\iunordered_map.h" />
|
||||
<ClInclude Include="..\..\ivector.h" />
|
||||
<ClInclude Include="..\..\jenkins.h" />
|
||||
<ClInclude Include="..\..\largest.h" />
|
||||
<ClInclude Include="..\..\list.h" />
|
||||
<ClInclude Include="..\..\list_base.h" />
|
||||
@ -267,6 +272,7 @@
|
||||
<ClCompile Include="..\test_error_handler.cpp" />
|
||||
<ClCompile Include="..\test_exception.cpp" />
|
||||
<ClCompile Include="..\test_fixed_iterator.cpp" />
|
||||
<ClCompile Include="..\test_flat_multimap.cpp" />
|
||||
<ClCompile Include="..\test_flat_set.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
||||
@ -423,6 +423,21 @@
|
||||
<ClInclude Include="..\murmurhash3.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\bsd_checksum.h">
|
||||
<Filter>ETL\Maths</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\jenkins.h">
|
||||
<Filter>ETL\Maths</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\flat_multimap.h">
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\flat_multimap_base.h">
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\iflat_multimap.h">
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\unittest-cpp\UnitTest++\AssertException.cpp">
|
||||
@ -647,6 +662,9 @@
|
||||
<ClCompile Include="..\murmurhash3.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_flat_multimap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Doxyfile">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user