rewrite of swiss, swiss will not be public but l4 specific
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the ¡°Software¡±), to deal in the Software without restriction,
|
||||
// files (the ��Software��), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
@@ -17,7 +17,7 @@
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
|
||||
// THE SOFTWARE IS PROVIDED ��AS IS��,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
@@ -32,6 +32,7 @@ using StgSharp;
|
||||
using StgSharp.Collections;
|
||||
using StgSharp.Script;
|
||||
using StgSharp.Script.Express;
|
||||
using Nitload.Common.Collections;
|
||||
|
||||
|
||||
//using StgSharp.Model;
|
||||
@@ -46,6 +47,22 @@ namespace STgSharpTest
|
||||
{
|
||||
string testExpPath = @"D:\Programmer\stepcode\data\ap203\ap203.exp";
|
||||
|
||||
[TestMethod]
|
||||
public void SwissTableOperationsAreNotImplemented()
|
||||
{
|
||||
using SwissTable table = SwissTable.Create();
|
||||
nuint key = 17;
|
||||
|
||||
Assert.ThrowsException<NotImplementedException>(
|
||||
() => SwissTable.Reader.TryGet(table, key, out _));
|
||||
Assert.ThrowsException<NotImplementedException>(
|
||||
() => SwissTable.Writer.TryAdd(table, key, 100));
|
||||
Assert.ThrowsException<NotImplementedException>(
|
||||
() => SwissTable.Writer.TrySet(table, key, 100));
|
||||
Assert.ThrowsException<NotImplementedException>(
|
||||
() => SwissTable.Writer.TryRemove(table, key, out _));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RegexTest()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nitload
|
||||
for (nuint i = 0; i < 5000; i++)
|
||||
{
|
||||
Console.Write($"Set {i}: ");
|
||||
_ = swiss.TryAddOrSet(i, i * 2, out _);
|
||||
_ = SwissTable.Writer.TrySet(swiss, i, i * 2);
|
||||
Console.WriteLine($"Set a kvp of ({i},{i * 2})");
|
||||
}
|
||||
Random rand = new Random();
|
||||
@@ -32,7 +32,7 @@ namespace Nitload
|
||||
{
|
||||
Console.Write($"Get {i}: ");
|
||||
nuint key = (nuint)rand.Next(4000, 5000);
|
||||
if (swiss.TryGet(key, out nuint value))
|
||||
if (SwissTable.Reader.TryGet(swiss, key, out nuint value))
|
||||
{
|
||||
Console.WriteLine($"Success in get a kvp of ({key},{value})");
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user