encompass-cs/test/BitSet1024Test.cs

63 lines
1.6 KiB
C#
Raw Normal View History

2019-12-23 00:21:07 +00:00
using Encompass.Collections;
using FluentAssertions;
using NUnit.Framework;
namespace Tests
{
public class BitSet512Test
2019-12-23 00:21:07 +00:00
{
[Test]
public void Zeroes()
{
var bitSet = BitSet512Builder.Zeroes();
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeTrue();
}
[Test]
public void Ones()
{
var bitSet = BitSet512Builder.Ones();
2019-12-23 00:21:07 +00:00
bitSet.AllTrue().Should().BeTrue();
}
[Test]
public void Set()
{
var bitSet = BitSet512Builder.Zeroes().Set(5);
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeFalse();
bitSet = BitSet512Builder.Zeroes().Set(132);
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeFalse();
bitSet = BitSet512Builder.Zeroes().Set(268);
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeFalse();
bitSet = BitSet512Builder.Zeroes().Set(450);
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeFalse();
}
[Test]
public void UnSet()
{
var bitSet = BitSet512Builder.Ones().UnSet(285);
bitSet.Get(285).Should().BeFalse();
bitSet.Set(285).AllTrue().Should().BeTrue();
2019-12-23 00:21:07 +00:00
}
[Test]
public void Get()
{
var bitSet = BitSet512Builder.Zeroes().Set(359);
2019-12-23 00:21:07 +00:00
bitSet.Get(359).Should().BeTrue();
bitSet.UnSet(359).AllFalse().Should().BeTrue();
}
[Test]
public void Not()
{
var bitSet = BitSet512Builder.Ones().Not();
2019-12-23 00:21:07 +00:00
bitSet.AllFalse().Should().BeTrue();
}
}
}