BasicBoolean.java revision 2362
809N/A * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. 809N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 809N/A * This code is free software; you can redistribute it and/or modify it 809N/A * under the terms of the GNU General Public License version 2 only, as 809N/A * published by the Free Software Foundation. 809N/A * This code is distributed in the hope that it will be useful, but WITHOUT 809N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 809N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 809N/A * version 2 for more details (a copy is included in the LICENSE file that 809N/A * accompanied this code). 809N/A * You should have received a copy of the GNU General Public License version 809N/A * 2 along with this work; if not, write to the Free Software Foundation, 809N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 809N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 809N/A * or visit www.oracle.com if you need additional information or have any 809N/A/* Type-specific source code for unit test 809N/A * Regenerate the BasicX classes via genBasic.sh whenever this file changes. 809N/A * We check in the generated source files so that the test tree can be used 809N/A * independently of the rest of the source tree. 809N/A// -- This file was mechanically generated: Do not edit! -- // public static void test() {
// Any characters not explicitly defined as conversions, date/time // conversion suffixes, or flags are illegal and are reserved for // future extensions. Use of such a character in a format string will // cause an UnknownFormatConversionException or // UnknownFormatFlagsException to be thrown. //--------------------------------------------------------------------- //--------------------------------------------------------------------- test(
"%4$2s %3$2s %2$2s %1$2s",
" d c b a",
"a",
"b",
"c",
"d");
test(
"Amount gained or lost since last statement: $ %,(.2f",
"Amount gained or lost since last statement: $ (6,217.58)",
testSysOut(
"Local time: %tT",
"Local time: 16:17:00", c);
test(
"Unable to open file '%1$s': %2$s",
"Unable to open file 'food': No such file or directory",
"food",
"No such file or directory");
test(
"Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
test(
"Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
test(
"Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
test(
"%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
"d c b a d c b a",
"a",
"b",
"c",
"d");
test(
"%s %s %<s %<s",
"a b b b",
"a",
"b",
"c",
"d");
test(
"%s %s %s %s",
"a b c d",
"a",
"b",
"c",
"d");
test(
"%2$s %s %<s %s",
"b a a b",
"a",
"b",
"c",
"d");
//--------------------------------------------------------------------- // General conversion applicable to any argument. //--------------------------------------------------------------------- test(
"%b",
"true",
true);
test(
"%b",
"false",
false);
test(
"%B",
"TRUE",
true);
test(
"%B",
"FALSE",
false);
test(
"%14b",
" true",
true);
test(
"%-14b",
"true ",
true);
test(
"%5.1b",
" f",
false);
test(
"%-5.1b",
"f ",
false);
test(
"%b",
"true",
"foo");
// Boolean.java hardcodes the Strings for "true" and "false", so no // localization is possible. // If you pass in a single array to a varargs method, the compiler // uses it as the array of arguments rather than treating it as a // single array-type argument. //--------------------------------------------------------------------- //--------------------------------------------------------------------- // correct or side-effect of implementation? //--------------------------------------------------------------------- // General conversion applicable to any argument. //--------------------------------------------------------------------- test(
"%c",
"H", (
byte)
72);
test(
"%c",
"i", (
short)
105);
test(
"%c",
"!", (
int)
33);
//--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- // General conversion applicable to any argument. //--------------------------------------------------------------------- test(
"%s",
"Hello, Duke",
"Hello, Duke");
test(
"%S",
"HELLO, DUKE",
"Hello, Duke");
test(
"%20S",
" HELLO, DUKE",
"Hello, Duke");
test(
"%20s",
" Hello, Duke",
"Hello, Duke");
test(
"%-20s",
"Hello, Duke ",
"Hello, Duke");
test(
"%-20.5s",
"Hello ",
"Hello, Duke");
//--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- // General conversion applicable to any argument. //--------------------------------------------------------------------- test(
"%10h",
" ddf63471",
"Hello, Duke");
test(
"%-10h",
"ddf63471 ",
"Hello, Duke");
test(
"%-10H",
"DDF63471 ",
"Hello, Duke");
test(
"%10h",
" 402e0000",
15.0);
test(
"%10H",
" 402E0000",
15.0);
//--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- // Date/Time conversions applicable to Calendar, Date, and long. //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- // perhaps an IllegalFormatArgumentIndexException should be defined?