Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Mar 24, 2024
1 parent acade9c commit 8ac3e08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ private bool IsAlreadyVisited(ExploreCandidateInfoNode info, out CLocation? firs

private void MarkAsVisited(ExploreCandidateInfoNode info)
{
try
{
_visitedNodeNames.Add(info.Name, info.Location);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
_visitedNodeNames.Add(info.Name, info.Location);
}

private bool IsExpectedCursor(ExploreCandidateInfoNode info)
Expand All @@ -123,15 +115,15 @@ private bool IsExpectedType(ExploreCandidateInfoNode info)
[LoggerMessage(1, LogLevel.Error, "- Unexpected type kind '{TypeKind}'")]
private partial void LogFailureUnexpectedType(CXTypeKind typeKind);

[LoggerMessage(2, LogLevel.Debug, "- Exploring {NodeKind} '{Name}' ({Location})'")]
private partial void LogExploring(CNodeKind nodeKind, string name, CLocation? location);

[LoggerMessage(3, LogLevel.Error, "- Already visited {NodeKind} '{Name}' ({Location})")]
[LoggerMessage(2, LogLevel.Information, "- Already visited {NodeKind} '{Name}' ({Location})")]
private partial void LogAlreadyVisited(CNodeKind nodeKind,
string name,
CLocation? location);

[LoggerMessage(4, LogLevel.Debug, "- Exploring {NodeKind} '{Name}' ({Location})'")]
[LoggerMessage(3, LogLevel.Debug, "- Exploring {NodeKind} '{Name}' ({Location})'")]
private partial void LogExploring(CNodeKind nodeKind, string name, CLocation? location);

[LoggerMessage(4, LogLevel.Debug, "- Explored {NodeKind} '{Name}' ({Location})'")]
private partial void LogExplored(CNodeKind nodeKind, string name, CLocation? location);

[LoggerMessage(5, LogLevel.Debug, "- Skipped exploring {NodeKind} '{Name}' ({Location})'")]
Expand Down
11 changes: 0 additions & 11 deletions src/cs/tests/c2ffi.Tests.Library/Models/CTestFfiCrossPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public CTestFfiCrossPlatform(
_functionPointers = functionPointers;
_opaqueTypes = opaqueTypes;
_namesTested = ImmutableHashSet.CreateBuilder<string>();

AssertPInvokePlatformNameFunction();
}

public void AssertNodesAreTested()
Expand Down Expand Up @@ -245,13 +243,4 @@ private void AssertRecordField(CTestRecord record, CTestRecordField field, List<
$"C union '{record.Name}' field '{field.Name}' does not have a size that matches the union.");
}
}

private void AssertPInvokePlatformNameFunction()
{
var function = GetFunction("ffi_get_platform_name");
Assert.Equal("cdecl", function.CallingConvention);
Assert.Equal("const char *", function.ReturnTypeName);
Assert.Equal("// Returns the current platform name.", function.Comment);
Assert.True(function.Parameters.IsDefaultOrEmpty);
}
}

0 comments on commit 8ac3e08

Please sign in to comment.