Skip to content

Commit 00ce73e

Browse files
committed
Fixup test cases, we now need to explicitly say we're okay with contracting it all away.
1 parent 951d30d commit 00ce73e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public List<Sgroup> generate(final IAtomContainer mol) {
383383
combined.setType(SgroupType.CtabAbbreviation);
384384
return Collections.singletonList(combined);
385385
}
386-
if (sgroup1 != null && (best == null || sgroup1.getAtoms().size() < best.getAtoms().size()))
386+
if (sgroup1 != null && (best == null || sgroup1.getAtoms().size() > best.getAtoms().size()))
387387
best = sgroup1;
388388
if (sgroup2 != null && (best == null || sgroup2.getAtoms().size() < best.getAtoms().size()))
389389
best = sgroup2;

app/depict/src/test/java/org/openscience/cdk/depict/AbbreviationsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public void potassiumCarbonate() throws Exception {
5151
IAtomContainer mol = smi("[K+].[O-]C(=O)[O-].[K+]");
5252
Abbreviations factory = new Abbreviations();
5353
factory.add("[K+].[O-]C(=O)[O-].[K+] K2CO3");
54+
factory.setContractToSingleLabel(true);
5455
List<Sgroup> sgroups = factory.generate(mol);
5556
assertThat(sgroups.size(), is(1));
5657
assertThat(sgroups.get(0).getSubscript(), is("K2CO3"));
@@ -302,6 +303,7 @@ public void dontOverwriteExistingSgroups() throws Exception {
302303
@Test public void hclSaltOfEdci() throws Exception {
303304
Abbreviations factory = new Abbreviations();
304305
factory.add("CCN=C=NCCCN(C)C EDCI");
306+
factory.setContractToSingleLabel(true);
305307
IAtomContainer mol = smi("CCN=C=NCCCN(C)C.Cl");
306308
List<Sgroup> sgroups = factory.generate(mol);
307309
assertThat(sgroups.size(), is(1));
@@ -329,6 +331,7 @@ public void dontOverwriteExistingSgroups() throws Exception {
329331
Abbreviations factory = new Abbreviations();
330332
factory.add("ClCCl DCM");
331333
factory.add("Cl[Pd]Cl.[Fe+2].c1ccc(P([c-]2cccc2)c2ccccc2)cc1.c1ccc(P([c-]2cccc2)c2ccccc2)cc1 Pd(dppf)Cl2");
334+
factory.setContractToSingleLabel(true);
332335
IAtomContainer mol = smi(smi);
333336
List<Sgroup> sgroups = factory.generate(mol);
334337
assertThat(sgroups.size(), is(1));
@@ -340,6 +343,7 @@ public void dontOverwriteExistingSgroups() throws Exception {
340343
Abbreviations factory = new Abbreviations();
341344
factory.add("Cl[Pd]Cl.[Fe+2].c1ccc(P([c-]2cccc2)c2ccccc2)cc1.c1ccc(P([c-]2cccc2)c2ccccc2)cc1 Pd(dppf)Cl2");
342345
factory.add("Cl[Pd]Cl PdCl2");
346+
factory.setContractToSingleLabel(true);
343347
IAtomContainer mol = smi(smi);
344348
List<Sgroup> sgroups = factory.generate(mol);
345349
assertThat(sgroups.size(), is(1));

0 commit comments

Comments
 (0)