File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed
src/Tests/MemoryModelTest Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 1+ using CommunityToolkit . HighPerformance . Buffers ;
2+
3+ namespace MemoryModelTest ;
4+
5+ public static class MemoryOwnerTest
6+ {
7+
8+ #region Constants & Statics
9+
10+ public static void SliceTest ( )
11+ {
12+ using var buffer = MemoryOwner < int > . Allocate ( 42 ) ;
13+ if ( buffer . Length > 50 )
14+ {
15+ using var buffer2 = buffer [ ..50 ] ;
16+
17+ var span = buffer2 . Span ;
18+ span [ 0 ] = 123 ;
19+ }
20+ }
21+
22+ #endregion
23+
24+ }
Original file line number Diff line number Diff line change @@ -30,7 +30,11 @@ public static void Main(string[] args)
3030
3131 //ArrayBufferWriterTest.Test();
3232
33- ArrayPoolBufferWriterTest . Test ( ) ;
33+ //ArrayPoolBufferWriterTest.Test();
34+
35+ //MemoryOwnerTest.SliceTest();
36+
37+ SpanOwnerTest . Test ( ) ;
3438 }
3539
3640 #endregion
Original file line number Diff line number Diff line change 1+ using CommunityToolkit . HighPerformance . Buffers ;
2+
3+ namespace MemoryModelTest ;
4+
5+ public static class SpanOwnerTest
6+ {
7+
8+ #region Constants & Statics
9+
10+ public static void Test ( )
11+ {
12+ using var buffer = SpanOwner < int > . Allocate ( 100 ) ;
13+
14+ var span = buffer . Span ;
15+ }
16+
17+ #endregion
18+
19+ }
You can’t perform that action at this time.
0 commit comments