26#include <boost/test/unit_test.hpp>
35 std::string cs = fmt::format(
"Driver={{SQLite3}};Database={}/database.sqlite",
36 QA_DATABASE_FILE_LOCATION );
40 BOOST_CHECK_NO_THROW( dc.
Connect() );
63 BOOST_CHECK( dc.
SelectOne(
"Resistors", std::make_pair(
"Part ID",
"RES-001" ), result ) );
65 BOOST_CHECK( !result.empty() );
66 BOOST_CHECK( result.count(
"MPN" ) );
67 BOOST_CHECK_NO_THROW( std::any_cast<std::string>( result.at(
"MPN" ) ) );
68 BOOST_CHECK_EQUAL( std::any_cast<std::string>( result.at(
"MPN" ) ),
"RC0603FR-0710KL" );
70 BOOST_CHECK( dc.
SelectOne(
"Capacitors", std::make_pair(
"Part ID",
"CAP-003" ), result ) );
72 BOOST_CHECK( !result.empty() );
73 BOOST_CHECK( result.count(
"Cost" ) );
74 BOOST_CHECK_NO_THROW( std::any_cast<std::string>( result.at(
"Cost" ) ) );
75 BOOST_CHECK_EQUAL( std::any_cast<std::string>( result.at(
"Cost" ) ),
"1.95" );
bool CacheTableInfo(const std::string &aTable, const std::set< std::string > &aColumns)
std::map< std::string, std::any > ROW
bool SelectOne(const std::string &aTable, const std::pair< std::string, std::string > &aWhere, ROW &aResult)
Retrieves a single row from a database table.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(Connect)
BOOST_AUTO_TEST_SUITE_END()