OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestBiMap.cpp File Reference

Unit tests for BiMap class (replacement for boost::bimap) More...

#include <gtest/gtest.h>
#include <string>
#include "Utilities/BiMap.h"
Include dependency graph for TestBiMap.cpp:

Go to the source code of this file.

Classes

class  BiMapTest
 

Functions

 TEST_F (BiMapTest, BasicInsertion)
 
 TEST_F (BiMapTest, LeftViewAccess)
 
 TEST_F (BiMapTest, RightViewAccess)
 
 TEST_F (BiMapTest, OutOfRangeException)
 
 TEST_F (BiMapTest, MakeBiMapHelper)
 
 TEST_F (BiMapTest, FindMethods)
 
 TEST_F (BiMapTest, StringToString)
 

Detailed Description

Unit tests for BiMap class (replacement for boost::bimap)

This file contains comprehensive unit tests for the BiMap bidirectional map implementation. The BiMap class provides a two-way mapping between left and right value types, allowing efficient lookup in both directions.

Test:
BiMapTest::BasicInsertion Tests basic insertion and bidirectional lookup functionality. Verifies that values can be inserted and retrieved from both left-to-right and right-to-left directions.
Test:
BiMapTest::LeftViewAccess Tests the left view accessor, which provides STL-compatible iterator interface for accessing the left-to-right mapping. Verifies find() and end() operations.
Test:
BiMapTest::RightViewAccess Tests the right view accessor, which provides STL-compatible iterator interface for accessing the right-to-left mapping. Verifies find() and end() operations.
Test:
BiMapTest::OutOfRangeException Tests exception handling when accessing non-existent keys. Verifies that std::out_of_range exceptions are thrown for both left_at() and right_at() when keys are not found.
Test:
BiMapTest::MakeBiMapHelper Tests the make_bimap() helper function for creating a BiMap from an initializer list. Verifies that the helper function correctly constructs the bidirectional mapping.
Test:
BiMapTest::FindMethods Tests the find methods (left_find() and right_find()) and their corresponding end iterators. Verifies that find operations return correct iterators for existing keys and end iterators for non-existent keys.
Test:
BiMapTest::StringToString Tests BiMap with string types for both left and right values. Verifies that the bidirectional mapping works correctly with string keys and values.

Definition in file TestBiMap.cpp.

Function Documentation

◆ TEST_F() [1/7]

TEST_F ( BiMapTest  ,
BasicInsertion   
)

Definition at line 53 of file TestBiMap.cpp.

References BiMap< Left, Right >::insert(), BiMap< Left, Right >::left_at(), and BiMap< Left, Right >::right_at().

Here is the call graph for this function:

◆ TEST_F() [2/7]

TEST_F ( BiMapTest  ,
FindMethods   
)

◆ TEST_F() [3/7]

TEST_F ( BiMapTest  ,
LeftViewAccess   
)

◆ TEST_F() [4/7]

TEST_F ( BiMapTest  ,
MakeBiMapHelper   
)

Definition at line 102 of file TestBiMap.cpp.

◆ TEST_F() [5/7]

TEST_F ( BiMapTest  ,
OutOfRangeException   
)

Definition at line 94 of file TestBiMap.cpp.

References BiMap< Left, Right >::insert(), BiMap< Left, Right >::left_at(), and BiMap< Left, Right >::right_at().

Here is the call graph for this function:

◆ TEST_F() [6/7]

TEST_F ( BiMapTest  ,
RightViewAccess   
)

◆ TEST_F() [7/7]

TEST_F ( BiMapTest  ,
StringToString   
)

Definition at line 134 of file TestBiMap.cpp.

References BiMap< Left, Right >::insert(), BiMap< Left, Right >::left_at(), and BiMap< Left, Right >::right_at().

Here is the call graph for this function: