1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.language.filters;
11
12 import junit.framework.Assert;
13 import junit.framework.TestCase;
14
15 /***
16 * Tests the ZeroFilter.
17 * <p>
18 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
19 * University of Technology </a>, the Netherlands. <br>
20 * See for project information <a
21 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
22 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
23 * License (GPL) </a>, no warranty <br>
24 *
25 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
26 * Jacobs </a>
27 * @version 1.2 Sep 28, 2004
28 * @since 1.4
29 */
30 public class ModulusFilterTest extends TestCase
31 {
32 /***
33 * constructs a new ZeroFilterTest
34 */
35 public ModulusFilterTest()
36 {
37 this("test");
38 }
39
40 /***
41 * constructs a new ZeroFilterTest
42 *
43 * @param arg0
44 */
45 public ModulusFilterTest(String arg0)
46 {
47 super(arg0);
48 }
49
50 /***
51 * tests the ZeroFilter.
52 */
53 public void test()
54 {
55 Filterinterface filter = new ModulusFilter(10);
56 for (int i = 0; i < 100; i++)
57 {
58 if (i % 10 == 0)
59 {
60 Assert.assertTrue(filter.accept("entry"));
61 } else
62 {
63 Assert.assertFalse(filter.accept("entry"));
64 }
65 }
66 }
67 }