blob: 97a5ed5478a2244bc755fbd6b6e6cdde39e1cf9e [file] [log] [blame]
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// This file has been automatically generated. Please do not edit it manually.
// Generated by tests/ffi/generator/address_of_test_generator.dart.
//
// SharedObjects=ffi_test_functions
// VMOptions=
// VMOptions=--deterministic --optimization-counter-threshold=90
// VMOptions=--use-slow-path
// VMOptions=--use-slow-path --stacktrace-every=100
// ignore_for_file: unused_import
import 'dart:ffi';
import 'dart:typed_data';
import 'package:expect/expect.dart';
import 'address_of_generated_shared.dart';
import 'address_of_shared.dart';
import 'dylib_utils.dart';
final ffiTestFunctions = dlopenPlatformSpecific('ffi_test_functions');
void main() {
// Force dlopen so @Native lookups in DynamicLibrary.process() succeed.
dlopenGlobalPlatformSpecific('ffi_test_functions');
for (int i = 0; i < 100; ++i) {
testAddressOfInt8List();
testAddressOfInt8ListElementAt();
testAddressOfInt8ListView();
testAddressOfInt8ListViewMany();
testAddressOfInt16List();
testAddressOfInt16ListElementAt();
testAddressOfInt16ListView();
testAddressOfInt16ListViewMany();
testAddressOfInt32List();
testAddressOfInt32ListElementAt();
testAddressOfInt32ListView();
testAddressOfInt32ListViewMany();
testAddressOfInt64List();
testAddressOfInt64ListElementAt();
testAddressOfInt64ListView();
testAddressOfInt64ListViewMany();
testAddressOfUint8List();
testAddressOfUint8ListElementAt();
testAddressOfUint8ListView();
testAddressOfUint8ListViewMany();
testAddressOfUint16List();
testAddressOfUint16ListElementAt();
testAddressOfUint16ListView();
testAddressOfUint16ListViewMany();
testAddressOfUint32List();
testAddressOfUint32ListElementAt();
testAddressOfUint32ListView();
testAddressOfUint32ListViewMany();
testAddressOfUint64List();
testAddressOfUint64ListElementAt();
testAddressOfUint64ListView();
testAddressOfUint64ListViewMany();
testAddressOfFloat32List();
testAddressOfFloat32ListElementAt();
testAddressOfFloat32ListView();
testAddressOfFloat32ListViewMany();
testAddressOfFloat64List();
testAddressOfFloat64ListElementAt();
testAddressOfFloat64ListView();
testAddressOfFloat64ListViewMany();
}
}
void testAddressOfInt8List() {
const length = 20;
final typedData = makeInt8List(length);
final expectedResult = makeExpectedResultInt8(0, length);
final result = takeInt8Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt8ListElementAt() {
const length = 20;
final typedData = makeInt8List(length);
final expectedResult = makeExpectedResultInt8(0, length);
final result = takeInt8PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt8ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeInt8List(sourceLength);
final view = Int8List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultInt8(viewStart, viewEnd);
final result = takeInt8Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt8ListViewMany() {
const length = 20;
final typedData = makeInt8List(length);
final expectedResult = makeExpectedResultInt8(0, length);
final result = takeInt8PointerMany(
Int8List.sublistView(typedData, 0, 0 + 1).address,
Int8List.sublistView(typedData, 1, 1 + 1).address,
Int8List.sublistView(typedData, 2, 2 + 1).address,
Int8List.sublistView(typedData, 3, 3 + 1).address,
Int8List.sublistView(typedData, 4, 4 + 1).address,
Int8List.sublistView(typedData, 5, 5 + 1).address,
Int8List.sublistView(typedData, 6, 6 + 1).address,
Int8List.sublistView(typedData, 7, 7 + 1).address,
Int8List.sublistView(typedData, 8, 8 + 1).address,
Int8List.sublistView(typedData, 9, 9 + 1).address,
Int8List.sublistView(typedData, 10, 10 + 1).address,
Int8List.sublistView(typedData, 11, 11 + 1).address,
Int8List.sublistView(typedData, 12, 12 + 1).address,
Int8List.sublistView(typedData, 13, 13 + 1).address,
Int8List.sublistView(typedData, 14, 14 + 1).address,
Int8List.sublistView(typedData, 15, 15 + 1).address,
Int8List.sublistView(typedData, 16, 16 + 1).address,
Int8List.sublistView(typedData, 17, 17 + 1).address,
Int8List.sublistView(typedData, 18, 18 + 1).address,
Int8List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt16List() {
const length = 20;
final typedData = makeInt16List(length);
final expectedResult = makeExpectedResultInt16(0, length);
final result = takeInt16Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt16ListElementAt() {
const length = 20;
final typedData = makeInt16List(length);
final expectedResult = makeExpectedResultInt16(0, length);
final result = takeInt16PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt16ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeInt16List(sourceLength);
final view = Int16List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultInt16(viewStart, viewEnd);
final result = takeInt16Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt16ListViewMany() {
const length = 20;
final typedData = makeInt16List(length);
final expectedResult = makeExpectedResultInt16(0, length);
final result = takeInt16PointerMany(
Int16List.sublistView(typedData, 0, 0 + 1).address,
Int16List.sublistView(typedData, 1, 1 + 1).address,
Int16List.sublistView(typedData, 2, 2 + 1).address,
Int16List.sublistView(typedData, 3, 3 + 1).address,
Int16List.sublistView(typedData, 4, 4 + 1).address,
Int16List.sublistView(typedData, 5, 5 + 1).address,
Int16List.sublistView(typedData, 6, 6 + 1).address,
Int16List.sublistView(typedData, 7, 7 + 1).address,
Int16List.sublistView(typedData, 8, 8 + 1).address,
Int16List.sublistView(typedData, 9, 9 + 1).address,
Int16List.sublistView(typedData, 10, 10 + 1).address,
Int16List.sublistView(typedData, 11, 11 + 1).address,
Int16List.sublistView(typedData, 12, 12 + 1).address,
Int16List.sublistView(typedData, 13, 13 + 1).address,
Int16List.sublistView(typedData, 14, 14 + 1).address,
Int16List.sublistView(typedData, 15, 15 + 1).address,
Int16List.sublistView(typedData, 16, 16 + 1).address,
Int16List.sublistView(typedData, 17, 17 + 1).address,
Int16List.sublistView(typedData, 18, 18 + 1).address,
Int16List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt32List() {
const length = 20;
final typedData = makeInt32List(length);
final expectedResult = makeExpectedResultInt32(0, length);
final result = takeInt32Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt32ListElementAt() {
const length = 20;
final typedData = makeInt32List(length);
final expectedResult = makeExpectedResultInt32(0, length);
final result = takeInt32PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt32ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeInt32List(sourceLength);
final view = Int32List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultInt32(viewStart, viewEnd);
final result = takeInt32Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt32ListViewMany() {
const length = 20;
final typedData = makeInt32List(length);
final expectedResult = makeExpectedResultInt32(0, length);
final result = takeInt32PointerMany(
Int32List.sublistView(typedData, 0, 0 + 1).address,
Int32List.sublistView(typedData, 1, 1 + 1).address,
Int32List.sublistView(typedData, 2, 2 + 1).address,
Int32List.sublistView(typedData, 3, 3 + 1).address,
Int32List.sublistView(typedData, 4, 4 + 1).address,
Int32List.sublistView(typedData, 5, 5 + 1).address,
Int32List.sublistView(typedData, 6, 6 + 1).address,
Int32List.sublistView(typedData, 7, 7 + 1).address,
Int32List.sublistView(typedData, 8, 8 + 1).address,
Int32List.sublistView(typedData, 9, 9 + 1).address,
Int32List.sublistView(typedData, 10, 10 + 1).address,
Int32List.sublistView(typedData, 11, 11 + 1).address,
Int32List.sublistView(typedData, 12, 12 + 1).address,
Int32List.sublistView(typedData, 13, 13 + 1).address,
Int32List.sublistView(typedData, 14, 14 + 1).address,
Int32List.sublistView(typedData, 15, 15 + 1).address,
Int32List.sublistView(typedData, 16, 16 + 1).address,
Int32List.sublistView(typedData, 17, 17 + 1).address,
Int32List.sublistView(typedData, 18, 18 + 1).address,
Int32List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt64List() {
const length = 20;
final typedData = makeInt64List(length);
final expectedResult = makeExpectedResultInt64(0, length);
final result = takeInt64Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt64ListElementAt() {
const length = 20;
final typedData = makeInt64List(length);
final expectedResult = makeExpectedResultInt64(0, length);
final result = takeInt64PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfInt64ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeInt64List(sourceLength);
final view = Int64List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultInt64(viewStart, viewEnd);
final result = takeInt64Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfInt64ListViewMany() {
const length = 20;
final typedData = makeInt64List(length);
final expectedResult = makeExpectedResultInt64(0, length);
final result = takeInt64PointerMany(
Int64List.sublistView(typedData, 0, 0 + 1).address,
Int64List.sublistView(typedData, 1, 1 + 1).address,
Int64List.sublistView(typedData, 2, 2 + 1).address,
Int64List.sublistView(typedData, 3, 3 + 1).address,
Int64List.sublistView(typedData, 4, 4 + 1).address,
Int64List.sublistView(typedData, 5, 5 + 1).address,
Int64List.sublistView(typedData, 6, 6 + 1).address,
Int64List.sublistView(typedData, 7, 7 + 1).address,
Int64List.sublistView(typedData, 8, 8 + 1).address,
Int64List.sublistView(typedData, 9, 9 + 1).address,
Int64List.sublistView(typedData, 10, 10 + 1).address,
Int64List.sublistView(typedData, 11, 11 + 1).address,
Int64List.sublistView(typedData, 12, 12 + 1).address,
Int64List.sublistView(typedData, 13, 13 + 1).address,
Int64List.sublistView(typedData, 14, 14 + 1).address,
Int64List.sublistView(typedData, 15, 15 + 1).address,
Int64List.sublistView(typedData, 16, 16 + 1).address,
Int64List.sublistView(typedData, 17, 17 + 1).address,
Int64List.sublistView(typedData, 18, 18 + 1).address,
Int64List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint8List() {
const length = 20;
final typedData = makeUint8List(length);
final expectedResult = makeExpectedResultUint8(0, length);
final result = takeUint8Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint8ListElementAt() {
const length = 20;
final typedData = makeUint8List(length);
final expectedResult = makeExpectedResultUint8(0, length);
final result = takeUint8PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint8ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeUint8List(sourceLength);
final view = Uint8List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultUint8(viewStart, viewEnd);
final result = takeUint8Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint8ListViewMany() {
const length = 20;
final typedData = makeUint8List(length);
final expectedResult = makeExpectedResultUint8(0, length);
final result = takeUint8PointerMany(
Uint8List.sublistView(typedData, 0, 0 + 1).address,
Uint8List.sublistView(typedData, 1, 1 + 1).address,
Uint8List.sublistView(typedData, 2, 2 + 1).address,
Uint8List.sublistView(typedData, 3, 3 + 1).address,
Uint8List.sublistView(typedData, 4, 4 + 1).address,
Uint8List.sublistView(typedData, 5, 5 + 1).address,
Uint8List.sublistView(typedData, 6, 6 + 1).address,
Uint8List.sublistView(typedData, 7, 7 + 1).address,
Uint8List.sublistView(typedData, 8, 8 + 1).address,
Uint8List.sublistView(typedData, 9, 9 + 1).address,
Uint8List.sublistView(typedData, 10, 10 + 1).address,
Uint8List.sublistView(typedData, 11, 11 + 1).address,
Uint8List.sublistView(typedData, 12, 12 + 1).address,
Uint8List.sublistView(typedData, 13, 13 + 1).address,
Uint8List.sublistView(typedData, 14, 14 + 1).address,
Uint8List.sublistView(typedData, 15, 15 + 1).address,
Uint8List.sublistView(typedData, 16, 16 + 1).address,
Uint8List.sublistView(typedData, 17, 17 + 1).address,
Uint8List.sublistView(typedData, 18, 18 + 1).address,
Uint8List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint16List() {
const length = 20;
final typedData = makeUint16List(length);
final expectedResult = makeExpectedResultUint16(0, length);
final result = takeUint16Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint16ListElementAt() {
const length = 20;
final typedData = makeUint16List(length);
final expectedResult = makeExpectedResultUint16(0, length);
final result = takeUint16PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint16ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeUint16List(sourceLength);
final view = Uint16List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultUint16(viewStart, viewEnd);
final result = takeUint16Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint16ListViewMany() {
const length = 20;
final typedData = makeUint16List(length);
final expectedResult = makeExpectedResultUint16(0, length);
final result = takeUint16PointerMany(
Uint16List.sublistView(typedData, 0, 0 + 1).address,
Uint16List.sublistView(typedData, 1, 1 + 1).address,
Uint16List.sublistView(typedData, 2, 2 + 1).address,
Uint16List.sublistView(typedData, 3, 3 + 1).address,
Uint16List.sublistView(typedData, 4, 4 + 1).address,
Uint16List.sublistView(typedData, 5, 5 + 1).address,
Uint16List.sublistView(typedData, 6, 6 + 1).address,
Uint16List.sublistView(typedData, 7, 7 + 1).address,
Uint16List.sublistView(typedData, 8, 8 + 1).address,
Uint16List.sublistView(typedData, 9, 9 + 1).address,
Uint16List.sublistView(typedData, 10, 10 + 1).address,
Uint16List.sublistView(typedData, 11, 11 + 1).address,
Uint16List.sublistView(typedData, 12, 12 + 1).address,
Uint16List.sublistView(typedData, 13, 13 + 1).address,
Uint16List.sublistView(typedData, 14, 14 + 1).address,
Uint16List.sublistView(typedData, 15, 15 + 1).address,
Uint16List.sublistView(typedData, 16, 16 + 1).address,
Uint16List.sublistView(typedData, 17, 17 + 1).address,
Uint16List.sublistView(typedData, 18, 18 + 1).address,
Uint16List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint32List() {
const length = 20;
final typedData = makeUint32List(length);
final expectedResult = makeExpectedResultUint32(0, length);
final result = takeUint32Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint32ListElementAt() {
const length = 20;
final typedData = makeUint32List(length);
final expectedResult = makeExpectedResultUint32(0, length);
final result = takeUint32PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint32ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeUint32List(sourceLength);
final view = Uint32List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultUint32(viewStart, viewEnd);
final result = takeUint32Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint32ListViewMany() {
const length = 20;
final typedData = makeUint32List(length);
final expectedResult = makeExpectedResultUint32(0, length);
final result = takeUint32PointerMany(
Uint32List.sublistView(typedData, 0, 0 + 1).address,
Uint32List.sublistView(typedData, 1, 1 + 1).address,
Uint32List.sublistView(typedData, 2, 2 + 1).address,
Uint32List.sublistView(typedData, 3, 3 + 1).address,
Uint32List.sublistView(typedData, 4, 4 + 1).address,
Uint32List.sublistView(typedData, 5, 5 + 1).address,
Uint32List.sublistView(typedData, 6, 6 + 1).address,
Uint32List.sublistView(typedData, 7, 7 + 1).address,
Uint32List.sublistView(typedData, 8, 8 + 1).address,
Uint32List.sublistView(typedData, 9, 9 + 1).address,
Uint32List.sublistView(typedData, 10, 10 + 1).address,
Uint32List.sublistView(typedData, 11, 11 + 1).address,
Uint32List.sublistView(typedData, 12, 12 + 1).address,
Uint32List.sublistView(typedData, 13, 13 + 1).address,
Uint32List.sublistView(typedData, 14, 14 + 1).address,
Uint32List.sublistView(typedData, 15, 15 + 1).address,
Uint32List.sublistView(typedData, 16, 16 + 1).address,
Uint32List.sublistView(typedData, 17, 17 + 1).address,
Uint32List.sublistView(typedData, 18, 18 + 1).address,
Uint32List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint64List() {
const length = 20;
final typedData = makeUint64List(length);
final expectedResult = makeExpectedResultUint64(0, length);
final result = takeUint64Pointer(typedData.address, length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint64ListElementAt() {
const length = 20;
final typedData = makeUint64List(length);
final expectedResult = makeExpectedResultUint64(0, length);
final result = takeUint64PointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfUint64ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeUint64List(sourceLength);
final view = Uint64List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultUint64(viewStart, viewEnd);
final result = takeUint64Pointer(view.address, view.length);
Expect.equals(expectedResult, result);
}
void testAddressOfUint64ListViewMany() {
const length = 20;
final typedData = makeUint64List(length);
final expectedResult = makeExpectedResultUint64(0, length);
final result = takeUint64PointerMany(
Uint64List.sublistView(typedData, 0, 0 + 1).address,
Uint64List.sublistView(typedData, 1, 1 + 1).address,
Uint64List.sublistView(typedData, 2, 2 + 1).address,
Uint64List.sublistView(typedData, 3, 3 + 1).address,
Uint64List.sublistView(typedData, 4, 4 + 1).address,
Uint64List.sublistView(typedData, 5, 5 + 1).address,
Uint64List.sublistView(typedData, 6, 6 + 1).address,
Uint64List.sublistView(typedData, 7, 7 + 1).address,
Uint64List.sublistView(typedData, 8, 8 + 1).address,
Uint64List.sublistView(typedData, 9, 9 + 1).address,
Uint64List.sublistView(typedData, 10, 10 + 1).address,
Uint64List.sublistView(typedData, 11, 11 + 1).address,
Uint64List.sublistView(typedData, 12, 12 + 1).address,
Uint64List.sublistView(typedData, 13, 13 + 1).address,
Uint64List.sublistView(typedData, 14, 14 + 1).address,
Uint64List.sublistView(typedData, 15, 15 + 1).address,
Uint64List.sublistView(typedData, 16, 16 + 1).address,
Uint64List.sublistView(typedData, 17, 17 + 1).address,
Uint64List.sublistView(typedData, 18, 18 + 1).address,
Uint64List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.equals(expectedResult, result);
}
void testAddressOfFloat32List() {
const length = 20;
final typedData = makeFloat32List(length);
final expectedResult = makeExpectedResultFloat(0, length);
final result = takeFloatPointer(typedData.address, length);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat32ListElementAt() {
const length = 20;
final typedData = makeFloat32List(length);
final expectedResult = makeExpectedResultFloat(0, length);
final result = takeFloatPointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat32ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeFloat32List(sourceLength);
final view = Float32List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultFloat(viewStart, viewEnd);
final result = takeFloatPointer(view.address, view.length);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat32ListViewMany() {
const length = 20;
final typedData = makeFloat32List(length);
final expectedResult = makeExpectedResultFloat(0, length);
final result = takeFloatPointerMany(
Float32List.sublistView(typedData, 0, 0 + 1).address,
Float32List.sublistView(typedData, 1, 1 + 1).address,
Float32List.sublistView(typedData, 2, 2 + 1).address,
Float32List.sublistView(typedData, 3, 3 + 1).address,
Float32List.sublistView(typedData, 4, 4 + 1).address,
Float32List.sublistView(typedData, 5, 5 + 1).address,
Float32List.sublistView(typedData, 6, 6 + 1).address,
Float32List.sublistView(typedData, 7, 7 + 1).address,
Float32List.sublistView(typedData, 8, 8 + 1).address,
Float32List.sublistView(typedData, 9, 9 + 1).address,
Float32List.sublistView(typedData, 10, 10 + 1).address,
Float32List.sublistView(typedData, 11, 11 + 1).address,
Float32List.sublistView(typedData, 12, 12 + 1).address,
Float32List.sublistView(typedData, 13, 13 + 1).address,
Float32List.sublistView(typedData, 14, 14 + 1).address,
Float32List.sublistView(typedData, 15, 15 + 1).address,
Float32List.sublistView(typedData, 16, 16 + 1).address,
Float32List.sublistView(typedData, 17, 17 + 1).address,
Float32List.sublistView(typedData, 18, 18 + 1).address,
Float32List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat64List() {
const length = 20;
final typedData = makeFloat64List(length);
final expectedResult = makeExpectedResultDouble(0, length);
final result = takeDoublePointer(typedData.address, length);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat64ListElementAt() {
const length = 20;
final typedData = makeFloat64List(length);
final expectedResult = makeExpectedResultDouble(0, length);
final result = takeDoublePointerMany(
typedData[0].address,
typedData[1].address,
typedData[2].address,
typedData[3].address,
typedData[4].address,
typedData[5].address,
typedData[6].address,
typedData[7].address,
typedData[8].address,
typedData[9].address,
typedData[10].address,
typedData[11].address,
typedData[12].address,
typedData[13].address,
typedData[14].address,
typedData[15].address,
typedData[16].address,
typedData[17].address,
typedData[18].address,
typedData[19].address,
);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat64ListView() {
const sourceLength = 30;
const viewStart = 10;
const viewLength = 10;
final viewEnd = viewStart + viewLength;
final source = makeFloat64List(sourceLength);
final view = Float64List.sublistView(source, viewStart, viewEnd);
final expectedResult = makeExpectedResultDouble(viewStart, viewEnd);
final result = takeDoublePointer(view.address, view.length);
Expect.approxEquals(expectedResult, result);
}
void testAddressOfFloat64ListViewMany() {
const length = 20;
final typedData = makeFloat64List(length);
final expectedResult = makeExpectedResultDouble(0, length);
final result = takeDoublePointerMany(
Float64List.sublistView(typedData, 0, 0 + 1).address,
Float64List.sublistView(typedData, 1, 1 + 1).address,
Float64List.sublistView(typedData, 2, 2 + 1).address,
Float64List.sublistView(typedData, 3, 3 + 1).address,
Float64List.sublistView(typedData, 4, 4 + 1).address,
Float64List.sublistView(typedData, 5, 5 + 1).address,
Float64List.sublistView(typedData, 6, 6 + 1).address,
Float64List.sublistView(typedData, 7, 7 + 1).address,
Float64List.sublistView(typedData, 8, 8 + 1).address,
Float64List.sublistView(typedData, 9, 9 + 1).address,
Float64List.sublistView(typedData, 10, 10 + 1).address,
Float64List.sublistView(typedData, 11, 11 + 1).address,
Float64List.sublistView(typedData, 12, 12 + 1).address,
Float64List.sublistView(typedData, 13, 13 + 1).address,
Float64List.sublistView(typedData, 14, 14 + 1).address,
Float64List.sublistView(typedData, 15, 15 + 1).address,
Float64List.sublistView(typedData, 16, 16 + 1).address,
Float64List.sublistView(typedData, 17, 17 + 1).address,
Float64List.sublistView(typedData, 18, 18 + 1).address,
Float64List.sublistView(typedData, 19, 19 + 1).address,
);
Expect.approxEquals(expectedResult, result);
}