-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new memory accessors setI52, setI64Big, getI52, getI64Big
* removed support for long form automatic marshaler. It has impact to mono_bind_static_method
- Loading branch information
1 parent
3749f82
commit d119e50
Showing
8 changed files
with
143 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/MemoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
namespace System.Runtime.InteropServices.JavaScript.Tests | ||
{ | ||
public class MemoryTests | ||
{ | ||
[Theory] | ||
[InlineData(-1L)] | ||
[InlineData(-42L)] | ||
[InlineData(int.MinValue)] | ||
[InlineData(-9007199254740991L)]//MIN_SAFE_INTEGER | ||
[InlineData(1L)] | ||
[InlineData(0L)] | ||
[InlineData(42L)] | ||
[InlineData(int.MaxValue)] | ||
[InlineData(0xF_FFFF_FFFFL)] | ||
[InlineData(9007199254740991L)]//MAX_SAFE_INTEGER | ||
public static unsafe void Int52TestOK(long value) | ||
{ | ||
long expected = value; | ||
long actual2 = value; | ||
var bagFn = new Function("ptr", "ptr2", @" | ||
const value=globalThis.App.MONO.getI52(ptr); | ||
globalThis.App.MONO.setI52(ptr2, value); | ||
return value;"); | ||
|
||
uint ptr = (uint)Unsafe.AsPointer(ref expected); | ||
uint ptr2 = (uint)Unsafe.AsPointer(ref actual2); | ||
|
||
object o = bagFn.Call(null, ptr, ptr2); | ||
if (value < int.MaxValue && value > int.MinValue) | ||
{ | ||
Assert.IsType<int>(o); | ||
long actual = (int)o; | ||
Assert.Equal(expected, actual); | ||
} | ||
Assert.Equal(expected, actual2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters