List of usage examples for java.util Arrays equals
public static boolean equals(Object[] a, Object[] a2)
From source file:com.opengamma.analytics.math.linearalgebra.QRDecompositionCommonsResultTest.java
@Test public void testSolvers() { assertTrue(Arrays.equals(RESULT_1D.getData(), QR.solve(RESULT_1D.getData()))); assertTrue(Arrays.equals(RESULT_1D.getData(), QR.solve(new DoubleMatrix1D(RESULT_1D.getData())).getData())); assertRealMatrixEquals(RESULT_2D, QR.solve(new DoubleMatrix2D(RESULT_2D.getData()))); }
From source file:com.google.dart.server.generated.types.ExtractLocalVariableFeedback.java
@Override public boolean equals(Object obj) { if (obj instanceof ExtractLocalVariableFeedback) { ExtractLocalVariableFeedback other = (ExtractLocalVariableFeedback) obj; return ObjectUtilities.equals(other.names, names) && Arrays.equals(other.offsets, offsets) && Arrays.equals(other.lengths, lengths); }//from w ww . java 2 s. c om return false; }
From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.PackedMatrixTest.java
@Test public void testBandedWithZeroRowRightSideZerosAllowedConstructor() { double[] expectedData = { 1.0, 2.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 6.0, 7.0, 8.0, 9.0, 10.0 }; PackedMatrix M = new PackedMatrix(_bandedwithzerorow, allowZerosOn.rightSide, 5, 5); assertTrue(Arrays.equals(M.getData(), expectedData)); }
From source file:my.adam.smo.EncryptionTest.java
@Test public void symetricEncryptionLongMessage() { ApplicationContext clientContext = new ClassPathXmlApplicationContext("Context.xml"); SymmetricEncryptionBox box = clientContext.getBean(SymmetricEncryptionBox.class); int plainTextLength = 17; byte[] plainText = new byte[plainTextLength]; random.nextBytes(plainText);//from ww w. ja va2s . c o m byte[] cryptogram = box.encrypt(plainText); Assert.assertFalse("plain text leaked!!!", Arrays.equals(plainText, Arrays.copyOfRange(cryptogram, SymmetricEncryptionBox.ivLength, cryptogram.length))); byte[] decrypted = box.decrypt(cryptogram); Assert.assertTrue("unable to decrypt", Arrays.equals(plainText, decrypted)); }
From source file:com.cloudera.flume.handlers.avro.TestAvroDataFile.java
@Test public void testAvroDataFileWriteRead() throws IOException, FlumeSpecException, InterruptedException { MemorySinkSource mem = MemorySinkSource.cannedData("test ", 5); // setup sink. File f = File.createTempFile("avrodata", ".avro"); f.deleteOnExit();// www . j av a2 s . co m LOG.info("filename before escaping: " + f.getAbsolutePath()); String custom = "text(\"" + StringEscapeUtils.escapeJava(f.getAbsolutePath()) + "\", \"avrodata\")"; LOG.info("sink to parse: " + custom); EventSink snk = FlumeBuilder.buildSink(new Context(), custom); snk.open(); mem.open(); EventUtil.dumpAll(mem, snk); snk.close(); mem.open(); DatumReader<EventImpl> dtm = new ReflectDatumReader<EventImpl>(EventImpl.class); DataFileReader<EventImpl> dr = new DataFileReader<EventImpl>(f, dtm); EventImpl eout = null; for (Object o : dr) { eout = (EventImpl) o; // TODO (jon) fix AVRO -- this is gross Event expected = mem.next(); Assert.assertTrue(Arrays.equals(eout.getBody(), expected.getBody())); } }
From source file:graph.core.OntologyFunction.java
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; OntologyFunction other = (OntologyFunction) obj; if (!Arrays.equals(nodes_, other.nodes_)) return false; return true;//from w w w . jav a 2 s .co m }
From source file:com.couchbase.lite.BlobStoreTest.java
private void verifyRawBlob(BlobKey key, byte[] clearText) throws IOException { String path = store.getRawPathForKey(key); byte[] raw;/*from w w w. j av a 2s . co m*/ InputStream is = new FileInputStream(path); try { raw = TextUtils.read(is); } finally { is.close(); } Assert.assertNotNull(raw); if (store.getEncryptionKey() == null) { Assert.assertTrue(Arrays.equals(raw, clearText)); } else { Assert.assertTrue(!Arrays.equals(raw, clearText)); } }
From source file:com.google.dart.server.generated.types.NavigationRegion.java
@Override public boolean equals(Object obj) { if (obj instanceof NavigationRegion) { NavigationRegion other = (NavigationRegion) obj; return other.offset == offset && other.length == length && Arrays.equals(other.targets, targets); }// w ww. j a v a 2 s . c om return false; }
From source file:com.lightboxtechnologies.nsrl.HashData.java
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof HashData)) return false; final HashData d = (HashData) o; return Arrays.equals(sha1, d.sha1) && Arrays.equals(md5, d.md5) && Arrays.equals(crc32, d.crc32) && name.equals(d.name) && size == d.size && prod_code == d.prod_code && os_code.equals(d.os_code) && special_code.equals(d.special_code); }
From source file:com.baidu.oped.apm.common.buffer.FixedBufferTest.java
@Test public void testPadBytes() throws Exception { int TOTAL_LENGTH = 20; int TEST_SIZE = 10; int PAD_SIZE = TOTAL_LENGTH - TEST_SIZE; Buffer buffer = new FixedBuffer(32); byte[] test = new byte[10]; random.nextBytes(test);/*from www.j a v a 2 s . c o m*/ buffer.putPadBytes(test, TOTAL_LENGTH); byte[] result = buffer.getBuffer(); Assert.assertEquals(result.length, TOTAL_LENGTH); Assert.assertTrue("check data", Arrays.equals(Arrays.copyOfRange(test, 0, TEST_SIZE), Arrays.copyOfRange(result, 0, TEST_SIZE))); byte[] padBytes = new byte[TOTAL_LENGTH - TEST_SIZE]; Assert.assertTrue("check pad", Arrays.equals(Arrays.copyOfRange(padBytes, 0, TEST_SIZE), Arrays.copyOfRange(result, TEST_SIZE, TOTAL_LENGTH))); }