-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* FIx macro object type infos * Add tests * Fix tests
- Loading branch information
1 parent
1aed7a7
commit 5b396f1
Showing
13 changed files
with
125 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"inputFilePath": "./main.c", | ||
"userIncludeDirectories": [ | ||
"../../../production/ffi_helper/include" | ||
], | ||
"ignoredIncludeFiles": [ | ||
"../../../production/ffi_helper/include/ffi_helper.h" | ||
], | ||
"targetPlatforms": { | ||
"windows": { | ||
"x86_64-pc-windows-msvc": {}, | ||
"aarch64-pc-windows-msvc": {} | ||
}, | ||
"macos": { | ||
"aarch64-apple-darwin": {}, | ||
"x86_64-apple-darwin": {}, | ||
"aarch64-apple-ios": {} | ||
}, | ||
"linux": { | ||
"x86_64-unknown-linux-gnu": {}, | ||
"aarch64-unknown-linux-gnu": {} | ||
} | ||
} | ||
} |
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,5 @@ | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include "ffi_helper.h" | ||
|
||
#define MACRO_OBJECT_UINT64 ((uint64_t)42) |
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
37 changes: 37 additions & 0 deletions
37
src/cs/tests/c2ffi.Tests.EndToEnd.Extract/MacroObjects/macro_object_uint64/Test.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,37 @@ | ||
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the Git repository root directory for full license information. | ||
|
||
using c2ffi.Tests.Library.Models; | ||
using FluentAssertions; | ||
|
||
#pragma warning disable CA1308 | ||
#pragma warning disable CA1707 | ||
|
||
namespace c2ffi.Tests.EndToEnd.Extract.MacroObjects.macro_object_uint64; | ||
|
||
public class Test : ExtractFfiTest | ||
{ | ||
private const string MacroObjectName = "MACRO_OBJECT_UINT64"; | ||
|
||
[Fact] | ||
public void MacroObject() | ||
{ | ||
var ffis = GetTargetPlatformFfis( | ||
$"src/c/tests/macro_objects/{MacroObjectName.ToLowerInvariant()}/config.json"); | ||
Assert.True(ffis.Length > 0); | ||
|
||
foreach (var ffi in ffis) | ||
{ | ||
FfiMacroObjectExists(ffi); | ||
} | ||
} | ||
|
||
private void FfiMacroObjectExists(CTestFfiTargetPlatform ffi) | ||
{ | ||
var macroObject = ffi.GetMacroObject(MacroObjectName); | ||
macroObject.Name.Should().Be(MacroObjectName); | ||
macroObject.Value.Should().Be("42"); | ||
macroObject.Type.Name.Should().Be("uint64_t"); | ||
macroObject.Type.InnerType.Should().NotBeNull(); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/cs/tests/c2ffi.Tests.EndToEnd.Merge/MacroObjects/macro_object_uint64/Test.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,33 @@ | ||
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the Git repository root directory for full license information. | ||
|
||
using c2ffi.Tests.Library.Models; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
#pragma warning disable CA1308 | ||
#pragma warning disable CA1707 | ||
|
||
namespace c2ffi.Tests.EndToEnd.Merge.MacroObjects.macro_object_uint64; | ||
|
||
public class Test : MergeFfisTest | ||
{ | ||
private const string MacroObjectName = "MACRO_OBJECT_UINT64"; | ||
|
||
[Fact] | ||
public void MacroObject() | ||
{ | ||
var ffi = GetCrossPlatformFfi( | ||
$"src/c/tests/macro_objects/{MacroObjectName.ToLowerInvariant()}/ffi"); | ||
FfiMacroObjectExists(ffi); | ||
} | ||
|
||
private void FfiMacroObjectExists(CTestFfiCrossPlatform ffi) | ||
{ | ||
var macroObject = ffi.GetMacroObject(MacroObjectName); | ||
macroObject.Name.Should().Be(MacroObjectName); | ||
macroObject.Value.Should().Be("42"); | ||
macroObject.Type.Name.Should().Be("uint64_t"); | ||
macroObject.Type.InnerType.Should().NotBeNull(); | ||
} | ||
} |
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