0N/A/*
2362N/A * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/* @test
0N/A * @summary Unit test for java.net.URL (Based on the URI tests that is authored by Mark Reinhold)
0N/A * @bug 4496251
0N/A */
0N/A
0N/Aimport java.io.ByteArrayInputStream;
0N/Aimport java.io.ByteArrayOutputStream;
0N/Aimport java.io.IOException;
0N/Aimport java.io.ObjectInputStream;
0N/Aimport java.io.ObjectOutputStream;
0N/Aimport java.io.PrintStream;
0N/Aimport java.net.URL;
0N/Aimport java.net.MalformedURLException;
0N/A
0N/A
0N/Apublic class Test {
0N/A
0N/A static PrintStream out = System.out;
0N/A static int testCount = 0;
0N/A
0N/A // Properties that we check
0N/A static final int PARSEFAIL = 1 << 0;
0N/A static final int PROTOCOL = 1 << 1;
0N/A static final int USERINFO = 1 << 2;
0N/A static final int HOST = 1 << 3;
0N/A static final int PORT = 1 << 4;
0N/A static final int PATH = 1 << 5;
0N/A static final int QUERY = 1 << 6;
0N/A static final int REF = 1 << 7;
0N/A
0N/A String input;
0N/A URL url = null;
0N/A URL originalURL;
0N/A URL base = null; // Base for resolution/relativization
0N/A String op = null; // Op performed if url != originalURL
0N/A int checked = 0; // Mask for checked properties
0N/A int failed = 0; // Mask for failed properties
0N/A Exception exc = null;
0N/A
0N/A private Test(String s) {
0N/A testCount++;
0N/A input = s;
0N/A try {
0N/A url = new URL(s);
0N/A } catch (MalformedURLException x) {
0N/A exc = x;
0N/A }
0N/A originalURL = url;
0N/A }
0N/A
0N/A static Test test(String s) {
0N/A return new Test(s);
0N/A }
0N/A
0N/A private Test(String s, boolean xxx) {
0N/A testCount++;
0N/A try {
0N/A url = new URL(s);
0N/A } catch (Exception x) {
0N/A exc = x;
0N/A }
0N/A if (url != null)
0N/A input = url.toString();
0N/A originalURL = url;
0N/A }
0N/A
0N/A static Test test(URL base, String spec) {
0N/A return new Test(base, spec);
0N/A }
0N/A private Test(URL base, String spec) {
0N/A testCount++;
0N/A try {
0N/A url = new URL(base, spec);
0N/A } catch (Exception x) {
0N/A exc = x;
0N/A }
0N/A if (url != null)
0N/A input = url.toString();
0N/A originalURL = url;
0N/A }
0N/A
0N/A static Test test(String protocol, String host, int port, String file) {
0N/A return new Test(protocol, host, port, file);
0N/A }
0N/A private Test(String protocol, String host, int port, String file) {
0N/A testCount++;
0N/A try {
0N/A url = new URL(protocol, host, port, file);
0N/A } catch (Exception x) {
0N/A exc = x;
0N/A }
0N/A if (url != null)
0N/A input = url.toString();
0N/A originalURL = url;
0N/A }
0N/A
0N/A boolean parsed() {
0N/A return url != null;
0N/A }
0N/A
0N/A boolean resolved() {
0N/A return base != null;
0N/A }
0N/A
0N/A URL url() {
0N/A return url;
0N/A }
0N/A
0N/A // Operations on Test instances
0N/A //
0N/A // These are short so as to make test cases compact.
0N/A //
0N/A // s Scheme
0N/A // u User info
0N/A // h Host
0N/A // n port Number
0N/A // p Path
0N/A // q Query
0N/A // f Fragment
0N/A //
0N/A // rslv Resolve against given base
0N/A // rtvz Relativize
0N/A // psa Parse server Authority
0N/A // norm Normalize
0N/A //
0N/A // x Check that parse failed as expected
0N/A // z End -- ensure that unchecked components are null
0N/A
0N/A private boolean check1(int prop) {
0N/A checked |= prop;
0N/A if (!parsed()) {
0N/A failed |= prop;
0N/A return false;
0N/A }
0N/A return true;
0N/A }
0N/A
0N/A private void check2(String s, String ans, int prop) {
0N/A if (s == null && ans == null)
0N/A return;
0N/A if ((s == null) || !s.equals(ans))
0N/A failed |= prop;
0N/A }
0N/A
0N/A Test s(String s) {
0N/A if (check1(PROTOCOL)) check2(url.getProtocol(), s, PROTOCOL);
0N/A return this;
0N/A }
0N/A
0N/A Test u(String s) {
0N/A if (check1(USERINFO)) check2(url.getUserInfo(), s, USERINFO);
0N/A return this;
0N/A }
0N/A
0N/A Test h(String s) {
0N/A if (check1(HOST)) check2(url.getHost(), s, HOST);
0N/A return this;
0N/A }
0N/A
0N/A Test n(int n) {
0N/A checked |= PORT;
0N/A if (!parsed() || (url.getPort() != n))
0N/A failed |= PORT;
0N/A return this;
0N/A }
0N/A
0N/A Test p(String s) {
0N/A if (check1(PATH)) check2(url.getPath(), s, PATH);
0N/A return this;
0N/A }
0N/A
0N/A Test q(String s) {
0N/A if (check1(QUERY)) check2(url.getQuery(), s, QUERY);
0N/A return this;
0N/A }
0N/A
0N/A Test f(String s) {
0N/A if (check1(REF)) check2(url.getRef(), s, REF);
0N/A return this;
0N/A }
0N/A
0N/A Test x() {
0N/A checked |= PARSEFAIL;
0N/A if (parsed())
0N/A failed |= PARSEFAIL;
0N/A return this;
0N/A }
0N/A
0N/A private void checkEmpty(String s, int prop) {
0N/A if (((checked & prop) == 0) && (s != null))
0N/A failed |= prop;
0N/A }
0N/A
0N/A // Check that unchecked component properties are not defined,
0N/A // and report any failures
0N/A Test z() {
0N/A if (!parsed()) {
0N/A report();
0N/A return this;
0N/A }
0N/A checkEmpty(url.getProtocol(), PROTOCOL);
0N/A checkEmpty(url.getUserInfo(), USERINFO);
0N/A checkEmpty(url.getHost(), HOST);
0N/A if (((checked & PORT) == 0) && (url.getPort() != -1)) failed |= PORT;
0N/A checkEmpty(url.getPath(), PATH);
0N/A checkEmpty(url.getQuery(), QUERY);
0N/A checkEmpty(url.getRef(), REF);
0N/A report();
0N/A return this;
0N/A }
0N/A
0N/A
0N/A // Summarization and reporting
0N/A
0N/A static void header(String s) {
0N/A out.println();
0N/A out.println();
0N/A out.println("-- " + s + " --");
0N/A }
0N/A
0N/A static void show(String prefix, MalformedURLException x) {
0N/A out.println(prefix + ": " + x.getMessage());
0N/A }
0N/A
0N/A private void summarize() {
0N/A out.println();
0N/A StringBuffer sb = new StringBuffer();
0N/A if (input.length() == 0)
0N/A sb.append("\"\"");
0N/A else
0N/A sb.append(input);
0N/A if (base != null) {
0N/A sb.append(" ");
0N/A sb.append(base);
0N/A }
0N/A if (!parsed()) {
0N/A String s = (((checked & PARSEFAIL) != 0)
0N/A ? "Correct exception" : "UNEXPECTED EXCEPTION");
0N/A if (exc instanceof MalformedURLException)
0N/A show(s, (MalformedURLException)exc);
0N/A else {
0N/A out.println(sb.toString());
0N/A out.print(s + ": ");
0N/A exc.printStackTrace(out);
0N/A }
0N/A } else {
0N/A if (url != originalURL) {
0N/A sb.append(" ");
0N/A sb.append(op);
0N/A sb.append(" --> ");
0N/A sb.append(url);
0N/A }
0N/A out.println(sb.toString());
0N/A }
0N/A }
0N/A
0N/A static void show(String n, String v) {
0N/A out.println(" " + n + " = ".substring(n.length()) + v);
0N/A }
0N/A
0N/A public static void show(URL u) {
0N/A show("scheme", u.getProtocol());
0N/A show("authority", u.getAuthority());
0N/A show("userInfo", u.getUserInfo());
0N/A show("host", u.getHost());
0N/A show("port", "" + u.getPort());
0N/A show("path", u.getPath());
0N/A show("query", u.getQuery());
0N/A show("ref", u.getRef());
0N/A }
0N/A
0N/A private void report() {
0N/A summarize();
0N/A if (failed == 0) return;
0N/A StringBuffer sb = new StringBuffer();
0N/A sb.append("FAIL:");
0N/A if ((failed & PARSEFAIL) != 0) sb.append(" parsefail");
0N/A if ((failed & PROTOCOL) != 0) sb.append(" scheme");
0N/A if ((failed & USERINFO) != 0) sb.append(" userinfo");
0N/A if ((failed & HOST) != 0) sb.append(" host");
0N/A if ((failed & PORT) != 0) sb.append(" port");
0N/A if ((failed & PATH) != 0) sb.append(" path");
0N/A if ((failed & QUERY) != 0) sb.append(" query");
0N/A if ((failed & REF) != 0) sb.append(" fragment");
0N/A out.println(sb.toString());
0N/A if (url != null) show(url);
0N/A throw new RuntimeException("Test failed");
0N/A }
0N/A
0N/A
0N/A
0N/A // -- Tests --
0N/A
0N/A static void rfc2396() {
0N/A
0N/A
0N/A header("RFC2396: Basic examples");
0N/A
0N/A test("ftp://ftp.is.co.za/rfc/rfc1808.txt")
0N/A .s("ftp").h("ftp.is.co.za").p("/rfc/rfc1808.txt").z();
0N/A
0N/A test("http://www.math.uio.no/faq/compression-faq/part1.html")
0N/A .s("http").h("www.math.uio.no").p("/faq/compression-faq/part1.html").z();
0N/A
0N/A test("http://www.w3.org/Addressing/")
0N/A .s("http").h("www.w3.org").p("/Addressing/").z();
0N/A
0N/A test("ftp://ds.internic.net/rfc/")
0N/A .s("ftp").h("ds.internic.net").p("/rfc/").z();
0N/A
0N/A test("http://www.ics.uci.edu/pub/ietf/url/historical.html#WARNING")
0N/A .s("http").h("www.ics.uci.edu").p("/pub/ietf/url/historical.html")
0N/A .f("WARNING").z();
0N/A
0N/A test("http://www.ics.uci.edu/pub/ietf/url/#Related")
0N/A .s("http").h("www.ics.uci.edu").p("/pub/ietf/url/")
0N/A .f("Related").z();
0N/A
0N/A test("file:/home/someone/dir1/dir2/file").s("file").h("").p("/home/someone/dir1/dir2/file").z();
0N/A
0N/A header("RFC2396: Normal relative-URL examples (appendix C)");
0N/A
0N/A URL base = (test("http://a/b/c/d;p?q")
0N/A .s("http").h("a").p("/b/c/d;p").q("q").z().url());
0N/A
0N/A // g:h g:h
0N/A // test(base, "http:h").s("g").p("h").z();
0N/A
0N/A // g http://a/b/c/g
0N/A test(base, "g").s("http").h("a").p("/b/c/g").z();
0N/A
0N/A // ./g http://a/b/c/g
0N/A test(base, "./g").s("http").h("a").p("/b/c/g").z();
0N/A
0N/A // g/ http://a/b/c/g/
0N/A test(base, "g/").s("http").h("a").p("/b/c/g/").z();
0N/A
0N/A // /g http://a/g
0N/A test(base, "/g").s("http").h("a").p("/g").z();
0N/A
0N/A // //g http://g
0N/A test(base,"//g").s("http").h("g").p("").z();
0N/A
0N/A // ?y http://a/b/c/?y
0N/A test(base, "?y").s("http").h("a").p("/b/c/").q("y").z();
0N/A
0N/A // g?y http://a/b/c/g?y
0N/A test(base, "g?y").s("http").h("a").p("/b/c/g").q("y").z();
0N/A
0N/A // #s (current document)#s
0N/A // DEVIATION: Lone fragment parses as relative URL with empty path,
0N/A // and resolves without removing the last segment of the base path.
0N/A // test(base,"#s").s("http").h("a").p("/b/c/d;p").f("s").z();
0N/A test(base,"#s").s("http").h("a").p("/b/c/d;p").q("q").f("s").z();
0N/A
0N/A // g#s http://a/b/c/g#s
0N/A test(base, "g#s").s("http").h("a").p("/b/c/g").f("s").z();
0N/A
0N/A // g?y#s http://a/b/c/g?y#s
0N/A test(base,"g?y#s").s("http").h("a").p("/b/c/g").q("y").f("s").z();
0N/A
0N/A // ;x http://a/b/c/;x
0N/A test(base,";x").s("http").h("a").p("/b/c/;x").z();
0N/A
0N/A // g;x http://a/b/c/g;x
0N/A test(base,"g;x").s("http").h("a").p("/b/c/g;x").z();
0N/A
0N/A // g;x?y#s http://a/b/c/g;x?y#s
0N/A test(base,"g;x?y#s").s("http").h("a").p("/b/c/g;x").q("y").f("s").z();
0N/A
0N/A // . http://a/b/c/
0N/A test(base,".").s("http").h("a").p("/b/c/").z();
0N/A
0N/A // ./ http://a/b/c/
0N/A test(base,"./").s("http").h("a").p("/b/c/").z();
0N/A
0N/A // .. http://a/b/
0N/A test(base,"..").s("http").h("a").p("/b/").z();
0N/A
0N/A // ../ http://a/b/
0N/A test(base,"../").s("http").h("a").p("/b/").z();
0N/A
0N/A // ../g http://a/b/g
0N/A test(base,"../g").s("http").h("a").p("/b/g").z();
0N/A
0N/A // ../.. http://a/
0N/A test(base,"../..").s("http").h("a").p("/").z();
0N/A
0N/A // ../../ http://a/
0N/A test(base,"../../").s("http").h("a").p("/").z();
0N/A
0N/A // ../../g http://a/g
0N/A test(base,"../../g").s("http").h("a").p("/g").z();
0N/A
0N/A
0N/A // http://u@s1/p1 http://s2/p2
0N/A test(test("http://u:p@s1/p1").url(),"http://s2/p2")
0N/A .s("http").h("s2").u(null).p("/p2").z();
0N/A
0N/A header("RFC2396: Abnormal relative-URL examples (appendix C)");
0N/A
0N/A // ../../../g = http://a/../g
0N/A test(base,"../../../g").s("http").h("a").p("/../g").z();
0N/A
0N/A // ../../../../g = http://a/../../g
0N/A test(base, "../../../../g").s("http").h("a").p("/../../g").z();
0N/A
0N/A
0N/A // /./g = http://a/./g
0N/A test(base,"/./g").s("http").h("a").p("/./g").z();
0N/A
0N/A // /../g = http://a/../g
0N/A test(base,"/../g").s("http").h("a").p("/../g").z();
0N/A
0N/A // g. = http://a/b/c/g.
0N/A test(base,"g.").s("http").h("a").p("/b/c/g.").z();
0N/A
0N/A // .g = http://a/b/c/.g
0N/A test(base,".g").s("http").h("a").p("/b/c/.g").z();
0N/A
0N/A // g.. = http://a/b/c/g..
0N/A test(base,"g..").s("http").h("a").p("/b/c/g..").z();
0N/A
0N/A // ..g = http://a/b/c/..g
0N/A test(base,"..g").s("http").h("a").p("/b/c/..g").z();
0N/A
0N/A // ./../g = http://a/b/g
0N/A test(base,"./../g").s("http").h("a").p("/b/g").z();
0N/A
0N/A // ./g/. = http://a/b/c/g/
0N/A test(base,"./g/.").s("http").h("a").p("/b/c/g/").z();
0N/A
0N/A // g/./h = http://a/b/c/g/h
0N/A test(base,"g/./h").s("http").h("a").p("/b/c/g/h").z();
0N/A
0N/A // g/../h = http://a/b/c/h
0N/A test(base,"g/../h").s("http").h("a").p("/b/c/h").z();
0N/A
0N/A // g;x=1/./y = http://a/b/c/g;x=1/y
0N/A test(base,"g;x=1/./y").s("http").h("a").p("/b/c/g;x=1/y").z();
0N/A
0N/A // g;x=1/../y = http://a/b/c/y
0N/A test(base,"g;x=1/../y").s("http").h("a").p("/b/c/y").z();
0N/A
0N/A // g?y/./x = http://a/b/c/g?y/./x
0N/A test(base,"g?y/./x").s("http").h("a").p("/b/c/g").q("y/./x").z();
0N/A
0N/A // g?y/../x = http://a/b/c/g?y/../x
0N/A test(base,"g?y/../x").s("http").h("a").p("/b/c/g").q("y/../x").z();
0N/A
0N/A // g#s/./x = http://a/b/c/g#s/./x
0N/A test(base,"g#s/./x").s("http").h("a").p("/b/c/g").f("s/./x").z();
0N/A
0N/A // g#s/../x = http://a/b/c/g#s/../x
0N/A test(base,"g#s/../x").s("http").h("a").p("/b/c/g").f("s/../x").z();
0N/A
0N/A // http:g = http:g
0N/A // test(base,"http:g").s("http").p("g").z();
0N/A
0N/A }
0N/A
0N/A
0N/A static void ip() {
0N/A
0N/A header("IP addresses");
0N/A
0N/A test("http://1.2.3.4:5")
0N/A .s("http").h("1.2.3.4").n(5).p("").z();
0N/A
0N/A // From RFC2732
0N/A
0N/A test("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html")
0N/A .s("http").h("[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]")
0N/A .n(80).p("/index.html").z();
0N/A
0N/A test("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210%12]:80/index.html")
0N/A .s("http").h("[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210%12]")
0N/A .n(80).p("/index.html").z();
0N/A
0N/A test("http://[1080:0:0:0:8:800:200C:417A]/index.html")
0N/A .s("http").h("[1080:0:0:0:8:800:200C:417A]").p("/index.html").z();
0N/A
0N/A test("http://[1080:0:0:0:8:800:200C:417A%1]/index.html")
0N/A .s("http").h("[1080:0:0:0:8:800:200C:417A%1]").p("/index.html").z();
0N/A
0N/A test("http://[3ffe:2a00:100:7031::1]")
0N/A .s("http").h("[3ffe:2a00:100:7031::1]").p("").z();
0N/A
0N/A test("http://[1080::8:800:200C:417A]/foo")
0N/A .s("http").h("[1080::8:800:200C:417A]").p("/foo").z();
0N/A
0N/A test("http://[::192.9.5.5]/ipng")
0N/A .s("http").h("[::192.9.5.5]").p("/ipng").z();
0N/A
0N/A test("http://[::192.9.5.5%interface]/ipng")
0N/A .s("http").h("[::192.9.5.5%interface]").p("/ipng").z();
0N/A
0N/A test("http://[::FFFF:129.144.52.38]:80/index.html")
0N/A .s("http").h("[::FFFF:129.144.52.38]").n(80).p("/index.html").z();
0N/A
0N/A test("http://[2010:836B:4179::836B:4179]")
0N/A .s("http").h("[2010:836B:4179::836B:4179]").p("").z();
0N/A
0N/A // From RFC2373
0N/A
0N/A test("http://[FF01::101]")
0N/A .s("http").h("[FF01::101]").p("").z();
0N/A
0N/A test("http://[::1]")
0N/A .s("http").h("[::1]").p("").z();
0N/A
0N/A test("http://[::]")
0N/A .s("http").h("[::]").p("").z();
0N/A
0N/A test("http://[::%hme0]")
0N/A .s("http").h("[::%hme0]").p("").z();
0N/A
0N/A test("http://[0:0:0:0:0:0:13.1.68.3]")
0N/A .s("http").h("[0:0:0:0:0:0:13.1.68.3]").p("").z();
0N/A
0N/A test("http://[0:0:0:0:0:FFFF:129.144.52.38]")
0N/A .s("http").h("[0:0:0:0:0:FFFF:129.144.52.38]").p("").z();
0N/A
0N/A test("http://[0:0:0:0:0:FFFF:129.144.52.38%33]")
0N/A .s("http").h("[0:0:0:0:0:FFFF:129.144.52.38%33]").p("").z();
0N/A
0N/A test("http://[::13.1.68.3]")
0N/A .s("http").h("[::13.1.68.3]").p("").z();
0N/A
0N/A test("http://[::13.1.68.3]:")
0N/A .s("http").h("[::13.1.68.3]").p("").z();
0N/A // Error cases
0N/A
0N/A test("http://[ff01:234/foo").x().z();
0N/A test("http://[ff01:234:zzz]/foo").x().z();
0N/A test("http://[foo]").x().z();
0N/A test("http://[]").x().z();
0N/A test("http://[129.33.44.55]").x().z();
0N/A test("http://[ff:ee:dd::cc:bb::aa:9:8]").x().z();
0N/A test("http://[1:2:3:4:5:6:7:8%]").x().z();
0N/A test("http://[1:2:3:4:5:6:7:8%!/]").x().z();
0N/A test("http://[1:2:3:4:5:6:7:8:9]").x().z();
0N/A test("http://[::1.2.3.300]").x().z();
0N/A test("http://[1.2.3.4:5]").x().z();
0N/A
0N/A // Optional IPv6 brackets in constructors
0N/A test("http", "1:2:3:4:5:6:7:8", -1, "")
0N/A .s("http").h("[1:2:3:4:5:6:7:8]").p("").z();
0N/A test("http", "1:2:3:4:5:6:7:8%hme0", -1, "")
0N/A .s("http").h("[1:2:3:4:5:6:7:8%hme0]").p("").z();
0N/A test("http", "[1:2:3:4:5:6:7:8]", -1, "")
0N/A .s("http").h("[1:2:3:4:5:6:7:8]").p("").z();
0N/A
0N/A }
0N/A
0N/A static void serial() throws IOException, MalformedURLException {
0N/A
0N/A header("Serialization");
0N/A
0N/A ByteArrayOutputStream bo = new ByteArrayOutputStream();
0N/A ObjectOutputStream oo = new ObjectOutputStream(bo);
0N/A URL u = new URL("http://java.sun.com/jdk/1.4?release#beta");
0N/A oo.writeObject(u);
0N/A oo.close();
0N/A
0N/A ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
0N/A ObjectInputStream oi = new ObjectInputStream(bi);
0N/A try {
0N/A Object o = oi.readObject();
0N/A u.equals(o);
0N/A } catch (ClassNotFoundException x) {
0N/A x.printStackTrace();
0N/A throw new RuntimeException(x.toString());
0N/A }
0N/A
0N/A }
0N/A
0N/A static void tests() throws IOException, MalformedURLException {
0N/A rfc2396();
0N/A ip();
0N/A serial();
0N/A }
0N/A
0N/A
0N/A // -- Command-line invocation --
0N/A
0N/A static void usage() {
0N/A out.println("Usage:");
0N/A out.println(" java Test -- Runs all tests in this file");
0N/A out.println(" java Test <url> -- Parses url, shows components");
0N/A out.println(" java Test <base> <url> -- Parses url and base, then resolves");
0N/A out.println(" url against base");
0N/A }
0N/A
0N/A public static void main(String[] args) throws Exception {
0N/A switch (args.length) {
0N/A
0N/A case 0:
0N/A tests();
0N/A out.println();
0N/A out.println("Test cases: " + testCount);
0N/A break;
0N/A
0N/A case 1:
0N/A if (args[0].equals("-help")) {
0N/A usage();
0N/A break;
0N/A }
0N/A // clargs(null, args[0]);
0N/A break;
0N/A
0N/A case 2:
0N/A // clargs(args[0], args[1]);
0N/A break;
0N/A
0N/A default:
0N/A usage();
0N/A break;
0N/A
0N/A }
0N/A }
0N/A
0N/A}