Skip to content

Commit

Permalink
Add test against ReadOnlySpan.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfbiedert committed Jun 20, 2024
1 parent 743fba6 commit fc7efd2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backends/csharp/tests/output_unsafe/Test.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Linq;
using My.Company;
using My.Company.Common;
using Xunit;
Expand Down Expand Up @@ -32,5 +34,19 @@ public void ensure_unsafe_copy_length()
Assert.True(r == size);
}
}

// Ensure that the Copied property has the correct length and contents
[Fact]
public void namespaced_inner_slice_readonly_span_works()
{
var vecs = new Vec[10];
var span = new ReadOnlySpan<Vec>(vecs);

vecs[0].x = 2.0;

var rval = Interop.namespaced_inner_slice(vecs);

Assert.True(rval[0].x > 1.0);
}
}
}

0 comments on commit fc7efd2

Please sign in to comment.