1 /*
2  * Copyright (C) 2012 John May <jwmay@users.sf.net>
3  *
4  * Contact: cdk-devel@lists.sourceforge.net
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your
9  * option) any later version. All we ask is that proper credit is given for our
10  * work, which includes - but is not limited to - adding the above copyright
11  * notice to the beginning of your source code files, and to any copyright
12  * notice that you may distribute with programs based on this work.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 package org.openscience.cdk.ringsearch;
24 
25 import org.junit.Test;
26 import org.openscience.cdk.AtomContainer;
27 import org.openscience.cdk.interfaces.IAtomContainer;
28 
29 import static org.hamcrest.CoreMatchers.is;
30 import static org.junit.Assert.assertFalse;
31 import static org.junit.Assert.assertThat;
32 import static org.junit.Assert.assertTrue;
33 
34 /**
35  * ring search unit tests for an empty molecule
36  *
37  * @author John May
38  * @cdk.module test-standard
39  */
40 public final class RingSearchTest_Empty {
41 
42     private final IAtomContainer empty = new AtomContainer(0, 0, 0, 0);
43 
44     @Test
testCyclic()45     public void testCyclic() {
46         assertThat(new RingSearch(empty).cyclic().length, is(0));
47     }
48 
49     @Test
testCyclic_Int()50     public void testCyclic_Int() {
51         int n = empty.getAtomCount();
52         RingSearch ringSearch = new RingSearch(empty);
53         for (int i = 0; i < n; i++) {
54             assertFalse(ringSearch.cyclic(i));
55         }
56     }
57 
58     @Test
testIsolated()59     public void testIsolated() {
60         assertThat(new RingSearch(empty).isolated().length, is(0));
61     }
62 
63     @Test
testFused()64     public void testFused() {
65         assertThat(new RingSearch(empty).fused().length, is(0));
66     }
67 
68     @Test
testRingFragments()69     public void testRingFragments() {
70         assertTrue(new RingSearch(empty).ringFragments().isEmpty());
71     }
72 
73     @Test
testIsolatedRingFragments()74     public void testIsolatedRingFragments() {
75         assertTrue(new RingSearch(empty).isolatedRingFragments().isEmpty());
76     }
77 
78     @Test
testFusedRingFragments()79     public void testFusedRingFragments() {
80         assertTrue(new RingSearch(empty).fusedRingFragments().isEmpty());
81     }
82 
83 }
84