Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion csharp/Platform.Data.Doublets.Tests/LinksConstantsTests.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
using Xunit;
using Platform.Ranges;

namespace Platform.Data.Doublets.Tests
{
public static class LinksConstantsTests
{
// TODO: Replace with Range.PositiveInt64 when available in Platform.Ranges
// This represents the range of positive 64-bit integers: [1, long.MaxValue]
private static readonly Range<ulong> PositiveInt64 = new Range<ulong>(1UL, (ulong)long.MaxValue);

[Fact]
public static void ExternalReferencesTest()
{
LinksConstants<ulong> constants = new LinksConstants<ulong>((1, long.MaxValue), (long.MaxValue + 1UL, ulong.MaxValue));
LinksConstants<ulong> constants = new LinksConstants<ulong>(PositiveInt64, new Range<ulong>((ulong)long.MaxValue + 1UL, ulong.MaxValue));

//var minimum = new Hybrid<ulong>(0, isExternal: true);
var minimum = new Hybrid<ulong>(1, isExternal: true);
Expand Down
71 changes: 71 additions & 0 deletions experiments/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using Platform.Data.Doublets;
using Platform.Data;

Console.WriteLine("Inspecting LinksConstants constructor");

// Try to understand LinksConstants constructor signature
var linksConstantsType = typeof(LinksConstants<ulong>);
var constructors = linksConstantsType.GetConstructors();

Console.WriteLine($"LinksConstants<ulong> has {constructors.Length} constructor(s):");

foreach (var ctor in constructors)
{
var parameters = ctor.GetParameters();
Console.WriteLine($"Constructor with {parameters.Length} parameter(s):");
for (int i = 0; i < parameters.Length; i++)
{
var param = parameters[i];
Console.WriteLine($" [{i}] {param.Name}: {param.ParameterType}");
}
Console.WriteLine();
}

// Now test the actual working call
Console.WriteLine("Testing working constructor call:");
try
{
var constants = new LinksConstants<ulong>((1, long.MaxValue), (long.MaxValue + 1UL, ulong.MaxValue));
Console.WriteLine("✓ Working constructor call succeeded");
}
catch (Exception e)
{
Console.WriteLine($"✗ Working constructor call failed: {e.Message}");
}

// Test the types of the working parameters
var param1 = (1, long.MaxValue);
var param2 = (long.MaxValue + 1UL, ulong.MaxValue);

Console.WriteLine($"Working param1 type: {param1.GetType()}");
Console.WriteLine($"Working param2 type: {param2.GetType()}");

// Test with explicit Range objects
Console.WriteLine("\nTesting with explicit Range objects:");

try
{
var range1 = new Platform.Ranges.Range<ulong>(1UL, (ulong)long.MaxValue);
var range2 = new Platform.Ranges.Range<ulong>((ulong)long.MaxValue + 1UL, ulong.MaxValue);
var constants2 = new LinksConstants<ulong>(range1, range2);
Console.WriteLine("✓ Explicit Range constructor call succeeded");
}
catch (Exception e)
{
Console.WriteLine($"✗ Explicit Range constructor call failed: {e.Message}");
}

// Test tuple to Range conversion
Console.WriteLine("\nTesting tuple to Range conversion:");
Console.WriteLine($"Can (1, long.MaxValue) convert to Range<ulong>?");

try
{
Platform.Ranges.Range<ulong> rangeFromTuple1 = (1, long.MaxValue);
Console.WriteLine($"✓ Implicit conversion succeeded: {rangeFromTuple1}");
}
catch (Exception e)
{
Console.WriteLine($"✗ Implicit conversion failed: {e.Message}");
}
18 changes: 18 additions & 0 deletions experiments/experiments.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Platform.Ranges" Version="0.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\csharp\Platform.Data.Doublets\Platform.Data.Doublets.csproj" />
</ItemGroup>

</Project>
Loading