Skip to content

Commit

Permalink
corrects previously correct test but not anymore correct
Browse files Browse the repository at this point in the history
  • Loading branch information
Wadym committed Aug 16, 2023
1 parent aff0e71 commit d1dfa6a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions api/c/tests/unit/tests/inchi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,21 @@ TEST_F(IndigoApiInchiTest, test_inchi)

TEST_F(IndigoApiInchiTest, basic)
{
const char* inchi = "InChI=1S/C10H20N2O2/c11-7-1-5-2-8(12)10(14)4-6(5)3-9(7)13/h5-10,13-14H,1-4,11-12H2";
const auto m = indigoInchiLoadMolecule(inchi);
ASSERT_EQ(strcmp(indigoCanonicalSmiles(m), "NC1CC2CC(N)C(O)CC2CC1O"), 0);
const char* res_inchi = indigoInchiGetInchi(m);
ASSERT_EQ(strcmp(res_inchi, inchi), 0);
const char* empty_inchi = "InChI=1S//";
const auto empty = indigoInchiLoadMolecule(empty_inchi);
const char* res_empty = indigoInchiGetInchi(empty);
ASSERT_EQ(strcmp(res_empty, empty_inchi), 0);
try
{
const char* inchi = "InChI=1S/C10H20N2O2/c11-7-1-5-2-8(12)10(14)4-6(5)3-9(7)13/h5-10,13-14H,1-4,11-12H2";
const auto m = indigoInchiLoadMolecule(inchi);
ASSERT_EQ(strcmp(indigoCanonicalSmiles(m), "NC1CC2CC(N)C(O)CC2CC1O"), 0);
const char* res_inchi = indigoInchiGetInchi(m);
ASSERT_EQ(strcmp(res_inchi, inchi), 0);
const char* empty_inchi = "InChI=1S//";
const auto empty = indigoInchiLoadMolecule(empty_inchi);
EXPECT_ANY_THROW(indigoInchiGetInchi(empty));
}
catch (const std::exception& e)
{
ASSERT_STREQ("inchi-wrapper: Indigo-InChI: no structural data has been provided: . Code: -1.", e.what());
}
}

TEST_F(IndigoApiInchiTest, incorrect_symbols)
Expand All @@ -71,6 +77,6 @@ TEST_F(IndigoApiInchiTest, incorrect_symbols)
}
catch (const std::exception& e)
{
ASSERT_STREQ("inchi-wrapper: Indigo-InChI: no structural data has been provided: (null). Code: -1.", e.what()); // e.message());
ASSERT_STREQ("inchi-wrapper: Indigo-InChI: no structural data has been provided: (null). Code: -1.", e.what());
}
}

0 comments on commit d1dfa6a

Please sign in to comment.