Skip to main content
summaryrefslogtreecommitdiffstats
blob: ff8773254e5c2b6b7c1b4c5792f038fdc97f2ec8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*******************************************************************************
 * Copyright (c) 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.xml.core.tests.hacks;

import org.eclipse.wst.xml.core.NameValidator;

public final class NameValidationTester {

	private static int nTrials = 100000;

	public NameValidationTester() {

		super();
	}

	public static void main(String[] args) {
		boolean isValid = false;
		long start = 0;
		long stop = 0;
		String[] testees = new String[]{"initial", "foo", "4", "9999", "f9999", "", "got space", " spacebefore", "spaceafter ", "ns:namespace", ":funnyns", "endns:", "us_underscore" , "_underscore", "underscore_", 
					"averylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersizeaverylongnamethatshouldgooverbuffersize"};
		for (int i = 0; i < testees.length; i++) {
			System.out.println();
			System.out.println();
			System.out.println("input: [" + testees[i] + "]");
			start = System.currentTimeMillis();
			for (int j = 0; j < nTrials; j++) {
				isValid = NameValidator.isValid(testees[i]);
			}
			stop = System.currentTimeMillis();
			System.out.println("\tNameValidator: " + isValid);
			System.out.println("\ttime: " + (stop - start));
		}
	}
}

Back to the top