source: trunk/gsdl3/packages/javagdbm/java/au/com/pharos/util/test/StringOpsTest.java@ 10737

Last change on this file since 10737 was 10737, checked in by kjdon, 19 years ago

Java Wrapper for GDBM, from Martin Pool. Original website gone, so added it all in here. I have modified the Makefiles to work in greenstone, and on macs, and added windows makefiles

  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1/*
2 * Copyright (C) 1997 by Pharos IP Pty Ltd
3 * Confidential. All rights reserved.
4 * $Id: StringOpsTest.java 10737 2005-10-19 03:06:40Z kjdon $
5 * $Source$
6 */
7
8package au.com.pharos.util.test;
9
10import au.com.pharos.test.Test;
11
12import au.com.pharos.util.StringOps;
13
14/**
15 * Test harness for <CODE>au.com.pharos.util.StringOps</CODE>
16 *
17 * @author Martin Pool
18 * @version $Revision: 10737 $ $Date: 2005-10-19 03:06:40 +0000 (Wed, 19 Oct 2005) $
19 **/
20public class StringOpsTest
21{
22 static public void main(String[] args)
23 {
24 new StringOpsTest().run();
25 }
26
27 public void run()
28 {
29 try {
30 testCountOccurrences();
31 }
32 finally {
33 Test.summary();
34 }
35 }
36
37 public void testCountOccurrences()
38 {
39 // Simple tests of countOccurences(String, char)
40 Test.ok(100, ( StringOps.countOccurrences("hello world", 'z') == 0) );
41 Test.ok(110, ( StringOps.countOccurrences("zhello world", 'z') == 1) );
42 Test.ok(120, ( StringOps.countOccurrences("hello worldz", 'z') == 1) );
43 Test.ok(130, ( StringOps.countOccurrences("z", 'z') == 1) );
44 Test.ok(140, ( StringOps.countOccurrences("zzz", 'z') == 3) );
45 Test.ok(150, ( StringOps.countOccurrences("0z0z0z", 'z') == 3) );
46 Test.ok(160, ( StringOps.countOccurrences("\0z\0z\0z", '\0') == 3) );
47 }
48}
Note: See TracBrowser for help on using the repository browser.