/** @since 0.8 or earlier */ @Test public void testCopyStructuredComplexToComplexNumbersA() throws Exception { String id = complexCopy(); if (id == null) { return; } PolyglotEngine.Value apply = findGlobalSymbol(id); ComplexNumbersA a = new ComplexNumbersA(new double[]{-1, -1, -1, -1, -1, -1}); Schema schema = new Schema(3, true, Arrays.asList(ComplexNumber.REAL_IDENTIFIER, ComplexNumber.IMAGINARY_IDENTIFIER), Arrays.asList(Type.DOUBLE, Type.DOUBLE)); byte[] buffer = new byte[6 * Double.SIZE / Byte.SIZE]; putDoubles(buffer, new double[]{41, 42, 43, 44, 45, 46}); StructuredData b = new StructuredData(buffer, schema); apply.execute(a, b); Assert.assertArrayEquals(new double[]{41, 42, 43, 44, 45, 46}, a.getData(), 0.1); }
/** @since 0.8 or earlier */ @Test public void testCopyComplexNumbersA() throws Exception { String id = complexCopy(); if (id == null) { return; } PolyglotEngine.Value apply = findGlobalSymbol(id); ComplexNumbersA a = new ComplexNumbersA(new double[]{-1, -1, -1, -1, -1, -1}); ComplexNumbersA b = new ComplexNumbersA(new double[]{41, 42, 43, 44, 45, 46}); apply.execute(a, b); Assert.assertArrayEquals(new double[]{41, 42, 43, 44, 45, 46}, a.getData(), 0.1); }
/** @since 0.8 or earlier */ @Test public void testCopyComplexNumbersB() throws Exception { String id = complexCopy(); if (id == null) { return; } PolyglotEngine.Value apply = findGlobalSymbol(id); ComplexNumbersB a = new ComplexNumbersB(new double[]{-1, -1, -1}, new double[]{-1, -1, -1}); ComplexNumbersB b = new ComplexNumbersB(new double[]{41, 43, 45}, new double[]{42, 44, 46}); apply.execute(a, b); Assert.assertArrayEquals(new double[]{41, 42, 43, 44, 45, 46}, a.getData(), 0.1); }