1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/tck/CompareStringsTest.java Fri Jan 11 16:07:55 2013 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,110 +0,0 @@
1.4 -/**
1.5 - * Back 2 Browser Bytecode Translator
1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful,
1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 - * GNU General Public License for more details.
1.16 - *
1.17 - * You should have received a copy of the GNU General Public License
1.18 - * along with this program. Look for COPYING file in the top folder.
1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 - */
1.21 -package org.apidesign.vm4brwsr.tck;
1.22 -
1.23 -import java.net.MalformedURLException;
1.24 -import java.net.URL;
1.25 -import org.apidesign.vm4brwsr.Compare;
1.26 -import org.apidesign.vm4brwsr.CompareVMs;
1.27 -import org.testng.annotations.Factory;
1.28 -
1.29 -/**
1.30 - *
1.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
1.32 - */
1.33 -public class CompareStringsTest {
1.34 - @Compare public static Object compareURLs() throws MalformedURLException {
1.35 - return new URL("http://apidesign.org:8080/wiki/").toExternalForm().toString();
1.36 - }
1.37 -
1.38 - @Compare public String deleteLastTwoCharacters() {
1.39 - StringBuilder sb = new StringBuilder();
1.40 - sb.append("453.0");
1.41 - if (sb.toString().endsWith(".0")) {
1.42 - final int l = sb.length();
1.43 - sb.delete(l - 2, l);
1.44 - }
1.45 - return sb.toString().toString();
1.46 - }
1.47 -
1.48 - @Compare public String nameOfStringClass() throws Exception {
1.49 - return Class.forName("java.lang.String").getName();
1.50 - }
1.51 - @Compare public String nameOfArrayClass() throws Exception {
1.52 - return Class.forName("org.apidesign.vm4brwsr.Array").getName();
1.53 - }
1.54 -
1.55 - @Compare public String lowerHello() {
1.56 - return "HeLlO".toLowerCase();
1.57 - }
1.58 -
1.59 - @Compare public String lowerA() {
1.60 - return String.valueOf(Character.toLowerCase('A')).toString();
1.61 - }
1.62 - @Compare public String upperHello() {
1.63 - return "hello".toUpperCase();
1.64 - }
1.65 -
1.66 - @Compare public String upperA() {
1.67 - return String.valueOf(Character.toUpperCase('a')).toString();
1.68 - }
1.69 -
1.70 - @Compare public boolean matchRegExp() throws Exception {
1.71 - return "58038503".matches("\\d*");
1.72 - }
1.73 -
1.74 - @Compare public boolean doesNotMatchRegExp() throws Exception {
1.75 - return "58038503GH".matches("\\d*");
1.76 - }
1.77 -
1.78 - @Compare public boolean doesNotMatchRegExpFully() throws Exception {
1.79 - return "Hello".matches("Hell");
1.80 - }
1.81 -
1.82 - @Compare public String variousCharacterTests() throws Exception {
1.83 - StringBuilder sb = new StringBuilder();
1.84 -
1.85 - sb.append(Character.isUpperCase('a'));
1.86 - sb.append(Character.isUpperCase('A'));
1.87 - sb.append(Character.isLowerCase('a'));
1.88 - sb.append(Character.isLowerCase('A'));
1.89 -
1.90 - sb.append(Character.isLetter('A'));
1.91 - sb.append(Character.isLetterOrDigit('9'));
1.92 - sb.append(Character.isLetterOrDigit('A'));
1.93 - sb.append(Character.isLetter('0'));
1.94 -
1.95 - return sb.toString().toString();
1.96 - }
1.97 -
1.98 - @Compare
1.99 - public String nullFieldInitialized() {
1.100 - NullField nf = new NullField();
1.101 - return ("" + nf.name).toString();
1.102 - }
1.103 -
1.104 - @Factory
1.105 - public static Object[] create() {
1.106 - return CompareVMs.create(CompareStringsTest.class);
1.107 - }
1.108 -
1.109 - private static final class NullField {
1.110 -
1.111 - String name;
1.112 - }
1.113 -}