Skip to content

Commit

Permalink
dart-lang#993. Changes according to review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Aug 2, 2022
1 parent 2e78f3e commit 42d4e24
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion LibTest/ffi/Bool/Bool_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import "../../../Utils/expect.dart";
void main() {
Pointer<Bool> p1 = calloc<Bool>();
try {
Expect.isFalse(p1.value);
p1.value = true;
Expect.isTrue(p1.value);
p1.value = false;
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/Bool/Bool_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "../../../Utils/expect.dart";

void main() {
Pointer<Bool> p1 = calloc<Bool>();
Pointer<Int16> p2 = new Pointer<Int16>.fromAddress(p1.address);
Pointer<Uint8> p2 = new Pointer<Uint8>.fromAddress(p1.address);
try {
p2.value = 0;
Expect.isFalse(p1.value);
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/Bool/Bool_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main() {
Pointer<Bool> p1 = calloc<Bool>(3);
try {
Expect.equals(1, p1.elementAt(1).address - p1.address);
Expect.equals(1, p1.elementAt(2).address - p1.elementAt(1).address);
Expect.equals(1, sizeOf<Bool>());
} finally {
calloc.free(p1);
}
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/Char/Char_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
Pointer<Char> p1 = calloc<Char>(3);
try {
Expect.equals(1, p1.elementAt(1).address - p1.address);
Expect.equals(1, p1.elementAt(2).address - p1.elementAt(1).address);
Expect.equals(1, sizeOf<Char>());
} finally {
calloc.free(p1);
}
Expand Down
5 changes: 2 additions & 3 deletions LibTest/ffi/Long/Long_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ import "../../../Utils/expect.dart";
void main() {
Pointer<Long> p1 = calloc<Long>();
try {
Expect.equals(0, p1.value);
p1.value = 42;
Expect.equals(42, p1.value);
p1.value = 32768;
Expect.equals(32768, p1.value);
p1.value = 2147483647; // 0x7FFFFFFF
Expect.equals(2147483647, p1.value);
p1.value = 0x7FFFFFFF;
Expect.equals(0x7FFFFFFF, p1.value);
} finally {
calloc.free(p1);
}
Expand Down
1 change: 1 addition & 0 deletions LibTest/ffi/Long/Long_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void main() {
try {
Expect.isTrue(p1.elementAt(1).address - p1.address == 4 ||
p1.elementAt(1).address - p1.address == 8);
Expect.isTrue(sizeOf<Long>() == 4 || sizeOf<Long>() == 8);
} finally {
calloc.free(p1);
}
Expand Down
1 change: 0 additions & 1 deletion LibTest/ffi/LongLong/LongLong_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import "../../../Utils/expect.dart";
void main() {
Pointer<LongLong> p1 = calloc<LongLong>();
try {
Expect.equals(0, p1.value);
p1.value = 42;
Expect.equals(42, p1.value);
p1.value = 32768;
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/LongLong/LongLong_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {
Pointer<LongLong> p1 = calloc<LongLong>(3);
try {
Expect.equals(8, p1.elementAt(1).address - p1.address);
Expect.equals(8, p1.elementAt(2).address - p1.elementAt(1).address);
Expect.equals(8, sizeOf<LongLong>);
} finally {
calloc.free(p1);
}
Expand Down
1 change: 0 additions & 1 deletion LibTest/ffi/Short/Short_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import "../../../Utils/expect.dart";
void main() {
Pointer<Short> p1 = calloc<Short>();
try {
Expect.equals(0, p1.value);
p1.value = 42;
Expect.equals(42, p1.value);
p1.value = -42;
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/Short/Short_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
Pointer<Short> p1 = calloc<Short>(3);
try {
Expect.equals(2, p1.elementAt(1).address - p1.address);
Expect.equals(2, p1.elementAt(2).address - p1.elementAt(1).address);
Expect.equals(2, sizeOf<Short>());
} finally {
calloc.free(p1);
}
Expand Down
2 changes: 1 addition & 1 deletion LibTest/ffi/SignedChar/SignedChar_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
Pointer<SignedChar> p1 = calloc<SignedChar>(3);
try {
Expect.equals(1, p1.elementAt(1).address - p1.address);
Expect.equals(1, p1.elementAt(2).address - p1.elementAt(1).address);
Expect.equals(1, sizeOf<SignedChar>());
} finally {
calloc.free(p1);
}
Expand Down

0 comments on commit 42d4e24

Please sign in to comment.