Skip to content

Commit 32f13c9

Browse files
committed
Add compare test
1 parent bdd170c commit 32f13c9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/LightningDB.Tests/SpanTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,26 @@ public void ValueShouldBeReadProperly()
4444
Assert.Equal(savedValue, value);
4545
}
4646
}
47+
48+
[Fact]
49+
public void ResultsFromSpanAndGetShouldBeSame()
50+
{
51+
using (var txn = _env.BeginTransaction())
52+
using (var db = txn.OpenDatabase(configuration: new DatabaseConfiguration
53+
{
54+
Flags = DatabaseOpenFlags.Create
55+
}))
56+
{
57+
var value = generator.Next(int.MinValue, int.MaxValue);
58+
var key = BitConverter.GetBytes(1);
59+
60+
txn.Put(db, key, BitConverter.GetBytes(value));
61+
62+
var span = txn.GetSpan(db, key);
63+
var bytes = txn.Get(db, key);
64+
65+
Assert.Equal(span.ToArray(), bytes);
66+
}
67+
}
4768
}
4869
}

0 commit comments

Comments
 (0)