Source Code Cross Referenced for HexUtilUTest.java in  » Test-Coverage » GroboUtils » net » sourceforge » groboutils » codecoverage » v2 » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » GroboUtils » net.sourceforge.groboutils.codecoverage.v2.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)HexUtilUTest.java
003:         *
004:         * Copyright (C) 2004 Matt Albrecht
005:         * groboclown@users.sourceforge.net
006:         * http://groboutils.sourceforge.net
007:         *
008:         *  Permission is hereby granted, free of charge, to any person obtaining a
009:         *  copy of this software and associated documentation files (the "Software"),
010:         *  to deal in the Software without restriction, including without limitation
011:         *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
012:         *  and/or sell copies of the Software, and to permit persons to whom the 
013:         *  Software is furnished to do so, subject to the following conditions:
014:         *
015:         *  The above copyright notice and this permission notice shall be included in 
016:         *  all copies or substantial portions of the Software. 
017:         *
018:         *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
019:         *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
020:         *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
021:         *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
022:         *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
023:         *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
024:         *  DEALINGS IN THE SOFTWARE.
025:         */
026:
027:        package net.sourceforge.groboutils.codecoverage.v2.util;
028:
029:        import java.util.zip.CRC32;
030:
031:        import junit.framework.Test;
032:        import junit.framework.TestCase;
033:        import junit.framework.TestSuite;
034:        import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
035:
036:        /**
037:         * Tests the ChecksumUtil class.
038:         *
039:         * @author    Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
040:         * @version   $Date: 2004/07/07 09:39:14 $
041:         * @since     July 7, 2004
042:         */
043:        public class HexUtilUTest extends TestCase {
044:            //-------------------------------------------------------------------------
045:            // Standard JUnit Class-specific declarations
046:
047:            private static final Class THIS_CLASS = HexUtilUTest.class;
048:            private static final AutoDoc DOC = new AutoDoc(THIS_CLASS);
049:
050:            public HexUtilUTest(String name) {
051:                super (name);
052:            }
053:
054:            //-------------------------------------------------------------------------
055:            // Tests
056:
057:            public void testGetInstance() {
058:                assertNotNull("getInstance must never return null.", HexUtil
059:                        .getInstance());
060:            }
061:
062:            public void testParseTwoHex1() {
063:                assertFalse("Null TS", HexUtil.getInstance().parseTwoHex("a a",
064:                        null, ' ', 0));
065:            }
066:
067:            public void testParseTwoHex2() {
068:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
069:                assertFalse("Null string", HexUtil.getInstance().parseTwoHex(
070:                        null, ts, ' ', 0));
071:            }
072:
073:            public void testParseTwoHex3() {
074:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
075:                assertFalse("Negative start", HexUtil.getInstance()
076:                        .parseTwoHex("a a", ts, ' ', -1));
077:            }
078:
079:            public void testParseTwoHex4() {
080:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
081:                assertFalse("No separator", HexUtil.getInstance().parseTwoHex(
082:                        "a", ts, ' ', 0));
083:            }
084:
085:            public void testParseTwoHex5() {
086:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
087:                assertFalse("No separator after start", HexUtil.getInstance()
088:                        .parseTwoHex("a a", ts, ' ', 2));
089:            }
090:
091:            public void testParseTwoHex6() {
092:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
093:                assertFalse("Start is after string length", HexUtil
094:                        .getInstance().parseTwoHex("x x", ts, ' ', 12));
095:            }
096:
097:            public void testParseTwoHex7() {
098:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
099:                assertTrue("Should have parsed correctly", HexUtil
100:                        .getInstance().parseTwoHex("0AAA F", ts, ' ', 0));
101:                assertEquals("Bad first string translate", 0x0AAA, ts.a);
102:                assertEquals("Bad second string translate", 0xF, ts.b);
103:            }
104:
105:            public void testParseTwoHex8() {
106:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
107:                assertTrue("Should have parsed correctly", HexUtil
108:                        .getInstance().parseTwoHex(" 0BB 12", ts, ' ', 1));
109:                assertEquals("Bad first string translate", 0x0BB, ts.a);
110:                assertEquals("Bad second string translate", 0x12, ts.b);
111:            }
112:
113:            public void testParseTwoHex9() {
114:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
115:                assertTrue("Should have parsed correctly", HexUtil
116:                        .getInstance().parseTwoHex("1 2    ", ts, ' ', 0));
117:                assertEquals("Bad first string translate", 0x1, ts.a);
118:                assertEquals("Bad second string translate", 0x2, ts.b);
119:            }
120:
121:            public void testParseTwoHex10() {
122:                HexUtil.TwoShorts ts = new HexUtil.TwoShorts();
123:                ts.a = ts.b = -1;
124:                assertTrue("Should have parsed correctly", HexUtil
125:                        .getInstance().parseTwoHex("0 0", ts, ' ', 0));
126:                assertEquals("Bad first string translate", 0x0, ts.a);
127:                assertEquals("Bad second string translate", 0x0, ts.b);
128:            }
129:
130:            //-------------------------------------------------------------------------
131:            // Standard JUnit declarations
132:
133:            public static Test suite() {
134:                TestSuite suite = new TestSuite(THIS_CLASS);
135:
136:                return suite;
137:            }
138:
139:            public static void main(String[] args) {
140:                String[] name = { THIS_CLASS.getName() };
141:
142:                // junit.textui.TestRunner.main( name );
143:                // junit.swingui.TestRunner.main( name );
144:
145:                junit.textui.TestRunner.main(name);
146:            }
147:
148:            /**
149:             * 
150:             * @exception Exception thrown under any exceptional condition.
151:             */
152:            protected void setUp() throws Exception {
153:                super .setUp();
154:
155:                // set ourself up
156:            }
157:
158:            /**
159:             * 
160:             * @exception Exception thrown under any exceptional condition.
161:             */
162:            protected void tearDown() throws Exception {
163:                // tear ourself down
164:
165:                super.tearDown();
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.