コード例 #1
0
        public void Invalid()
        {
            var s = new Segtree <string, MonoidOperator>(10);

            s.Invoking(s => s[-1]).Should().ThrowContractAssert();
            s.Invoking(s => s[10]).Should().ThrowContractAssert();
            s.Invoking(s => s[0]).Should().NotThrow();
            s.Invoking(s => s[9]).Should().NotThrow();

            s.Invoking(s => s.Prod(-1, -1)).Should().ThrowContractAssert();
            s.Invoking(s => s.Prod(3, 2)).Should().ThrowContractAssert();
            s.Invoking(s => s.Prod(0, 11)).Should().ThrowContractAssert();
            s.Invoking(s => s.Prod(-1, 11)).Should().ThrowContractAssert();
            s.Invoking(s => s.Prod(0, 0)).Should().NotThrow();
            s.Invoking(s => s.Prod(10, 10)).Should().NotThrow();
            s.Invoking(s => s.Prod(0, 10)).Should().NotThrow();

            s.Invoking(s => s.MaxRight(11, s => true)).Should().ThrowContractAssert();
            s.Invoking(s => s.MaxRight(-1, s => true)).Should().ThrowContractAssert();
            s.Invoking(s => s.MaxRight(0, s => false)).Should().ThrowContractAssert();
            s.Invoking(s => s.MaxRight(0, s => true)).Should().NotThrow();
            s.Invoking(s => s.MaxRight(10, s => true)).Should().NotThrow();

            s.Invoking(s => s.MinLeft(11, s => true)).Should().ThrowContractAssert();
            s.Invoking(s => s.MinLeft(-1, s => true)).Should().ThrowContractAssert();
            s.Invoking(s => s.MinLeft(0, s => false)).Should().ThrowContractAssert();
            s.Invoking(s => s.MinLeft(0, s => true)).Should().NotThrow();
            s.Invoking(s => s.MinLeft(10, s => true)).Should().NotThrow();
        }
コード例 #2
0
        public void One()
        {
            var s = new Segtree <string, MonoidOperator>(1);

            s.AllProd.Should().Be("$");
            s[0].Should().Be("$");
            s.Prod(0, 1).Should().Be(s[0..1]).And.Be("$");
コード例 #3
0
ファイル: Segtree.cs プロジェクト: terry-u16/ac-library-cs
 public DebugView(Segtree <TValue, TOp> segtree)
 {
     this.segtree = segtree;
 }
コード例 #4
0
        public void Zero()
        {
            var s = new Segtree <string, MonoidOperator>(0);

            s.AllProd.Should().Be("$");
        }