use of dalvik.annotation.BrokenTest in project robovm by robovm.
the class OldNumberFormatTest method test_parseLjava_lang_String.
@BrokenTest("Fails in CTS, passes in CoreTestRunner")
public void test_parseLjava_lang_String() {
NumberFormat nf1 = NumberFormat.getInstance();
try {
assertEquals("Test1: NumberFormat.getInstance().parse(\"1234567890.1\") returned wrong number", new Double(1234567890.1), nf1.parse("1234567890.1"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for 1234567890.1");
}
try {
assertEquals("Test2: NumberFormat.getInstance().parse(\"-1234567890.1\") returned wrong number", new Double(-1234567890.1), nf1.parse("-1,234,567,890.1"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for -1,234,567,890.1");
}
try {
nf1.parse("@1,234,567,8901");
fail("java.text.ParseException is not thrown for 1,234,567,890z1");
} catch (java.text.ParseException pe) {
// expected
}
nf1 = NumberFormat.getPercentInstance();
try {
assertEquals("Test3: NumberFormat.getPercentInstance().parse(\"-123%\") returned wrong number", new Double(-1.23), nf1.parse("-123%"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for -123%");
}
nf1 = NumberFormat.getCurrencyInstance();
try {
assertEquals("Test4: NumberFormat.getCurrencyInstance().parse(\"$123\") returned wrong number", new Long(123), nf1.parse("$123"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for $123");
}
try {
assertEquals("Test4: NumberFormat.getCurrencyInstance().parse(\"$123abc\") returned wrong number", new Long(123), nf1.parse("$123abc"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for $123");
}
nf1 = NumberFormat.getIntegerInstance();
try {
assertEquals("Test5: NumberFormat.getIntegerInstance().parse(\"-123.123\") returned wrong number", nf1.parseObject("-123.123"), nf1.parse("-123.123"));
} catch (java.text.ParseException pe) {
fail("java.text.ParseException is thrown for $123");
}
}
use of dalvik.annotation.BrokenTest in project robovm by robovm.
the class OldSocketChannelTest method test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData.
@BrokenTest("Occasionally fail in CTS, but works in CoreTestRunner")
public void test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData() throws IOException {
// initialize write content
ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_HUGE);
for (int i = 0; i < CAPACITY_HUGE; i++) {
writeContent.put((byte) i);
}
writeContent.flip();
// establish connection
channel1.connect(localAddr1);
Socket acceptedSocket = server1.accept();
channel1.configureBlocking(false);
int writtenTotalCount = 0;
int writtenCount = 1;
long startTime = System.currentTimeMillis();
// use SocketChannel.write(ByteBuffer) to try to write CAPACITY_HUGE bytes
while (writtenTotalCount < CAPACITY_HUGE && writtenCount > 0) {
writtenCount = channel1.write(writeContent);
if (writtenCount == 0 && writtenTotalCount < CAPACITY_HUGE) {
assertEquals(0, channel1.write(writeContent));
break;
}
writtenTotalCount += writtenCount;
// if the channel could not finish writing in TIMEOUT ms, the
// test fails. It is used to guarantee the test never hangs even
// if there are bugs of SocketChannel implementation.
assertTimeout(startTime, TIMEOUT);
}
}
use of dalvik.annotation.BrokenTest in project robovm by robovm.
the class DHPublicKeyTest method test_getParams.
@BrokenTest("Too slow - disabling for now")
public void test_getParams() throws Exception {
KeyPairGenerator kg = KeyPairGenerator.getInstance("DH");
kg.initialize(1024);
KeyPair kp1 = kg.genKeyPair();
KeyPair kp2 = kg.genKeyPair();
DHPublicKey pk1 = (DHPublicKey) kp1.getPublic();
DHPublicKey pk2 = (DHPublicKey) kp2.getPublic();
assertTrue(pk1.getY().getClass().getCanonicalName().equals("java.math.BigInteger"));
assertTrue(pk2.getParams().getClass().getCanonicalName().equals("javax.crypto.spec.DHParameterSpec"));
assertFalse(pk1.equals(pk2));
assertTrue(pk1.getY().equals(pk1.getY()));
}
use of dalvik.annotation.BrokenTest in project robovm by robovm.
the class OldDHTest method testDHGen.
@BrokenTest("Suffers from DH slowness, disabling for now")
public void testDHGen() throws Exception {
KeyPairGenerator gen = null;
try {
gen = KeyPairGenerator.getInstance("DH");
} catch (NoSuchAlgorithmException e) {
fail(e.getMessage());
}
AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance("DH");
algorithmparametergenerator.init(1024, new SecureRandom());
AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters();
DHParameterSpec dhparameterspec = algorithmparameters.getParameterSpec(DHParameterSpec.class);
//gen.initialize(1024);
gen.initialize(dhparameterspec);
KeyPair key = gen.generateKeyPair();
}
use of dalvik.annotation.BrokenTest in project robovm by robovm.
the class OldKeyPairGeneratorTestDH method testKeyPairGenerator.
@BrokenTest("Takes ages due to DH computations. Disabling for now.")
public void testKeyPairGenerator() throws NoSuchAlgorithmException {
KeyPairGenerator generator = KeyPairGenerator.getInstance("DH");
generator.initialize(1024);
KeyPair keyPair = generator.generateKeyPair();
assertNotNull("no keypair generated", keyPair);
assertNotNull("no public key generated", keyPair.getPublic());
assertNotNull("no private key generated", keyPair.getPrivate());
new KeyAgreementHelper("DH").test(keyPair);
}
Aggregations