63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using Encompass.Collections;
|
|
using FluentAssertions;
|
|
using NUnit.Framework;
|
|
|
|
namespace Tests
|
|
{
|
|
public class BitSetTest
|
|
{
|
|
[Test]
|
|
public void Zeroes()
|
|
{
|
|
var bitSet = BitSetBuilder.Zeroes();
|
|
bitSet.AllFalse().Should().BeTrue();
|
|
}
|
|
|
|
[Test]
|
|
public void Ones()
|
|
{
|
|
var bitSet = BitSetBuilder.Ones();
|
|
bitSet.AllTrue().Should().BeTrue();
|
|
}
|
|
|
|
[Test]
|
|
public void Set()
|
|
{
|
|
var bitSet = BitSetBuilder.Zeroes().Set(5);
|
|
bitSet.AllFalse().Should().BeFalse();
|
|
|
|
bitSet = BitSetBuilder.Zeroes().Set(132);
|
|
bitSet.AllFalse().Should().BeFalse();
|
|
|
|
bitSet = BitSetBuilder.Zeroes().Set(268);
|
|
bitSet.AllFalse().Should().BeFalse();
|
|
|
|
bitSet = BitSetBuilder.Zeroes().Set(450);
|
|
bitSet.AllFalse().Should().BeFalse();
|
|
}
|
|
|
|
[Test]
|
|
public void UnSet()
|
|
{
|
|
var bitSet = BitSetBuilder.Ones().UnSet(285);
|
|
bitSet.Get(285).Should().BeFalse();
|
|
bitSet.Set(285).AllTrue().Should().BeTrue();
|
|
}
|
|
|
|
[Test]
|
|
public void Get()
|
|
{
|
|
var bitSet = BitSetBuilder.Zeroes().Set(359);
|
|
bitSet.Get(359).Should().BeTrue();
|
|
bitSet.UnSet(359).AllFalse().Should().BeTrue();
|
|
}
|
|
|
|
[Test]
|
|
public void Not()
|
|
{
|
|
var bitSet = BitSetBuilder.Ones().Not();
|
|
bitSet.AllFalse().Should().BeTrue();
|
|
}
|
|
}
|
|
}
|