private CRTNode <string> treeWithLeftMostInsert()
        {
            var t = new CRTRoot <string>(
                new CRTInner <string>(0, UInt128.FromZeroFilledPrefix("0"),
                                      new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("00"),
                                                            new CRTInner <string>(3, UInt128.FromZeroFilledPrefix("0000"),
                                                                                  // START: difference
                                                                                  new CRTLeaf <string>(UInt128.FromZeroFilledPrefix("0000"), "none"),
                                                                                  new CRTInner <string>(4, UInt128.FromZeroFilledPrefix("00001"),
                                                                                                        new CRTLeaf <string>(UInt128.FromZeroFilledPrefix("000010"), "hi!"),
                                                                                                        new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("000011"))
                                                                                                        )
                                                                                  // END: difference
                                                                                  ),
                                                            new CRTInner <string>(3, UInt128.FromZeroFilledPrefix("0010"),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00100")),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00101"))
                                                                                  )
                                                            ),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("01"))
                                      ),
                new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("11"),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("110")),
                                      new CRTLeaf <string>(UInt128.Zero.Sub(UInt128.One), "all one or none!")
                                      )
                );

            return(t);
        }
        private CRTNode <string> treeWithAlmostRightMostInsert()
        {
            var t = new CRTRoot <string>(
                new CRTInner <string>(0, UInt128.FromZeroFilledPrefix("0"),
                                      new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("00"),
                                                            new CRTInner <string>(4, UInt128.FromZeroFilledPrefix("00001"),
                                                                                  new CRTLeaf <string>(UInt128.FromZeroFilledPrefix("000010"), "hi!"),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("000011"))
                                                                                  ),
                                                            new CRTInner <string>(3, UInt128.FromZeroFilledPrefix("0010"),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00100")),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00101"))
                                                                                  )
                                                            ),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("01"))
                                      ),
                new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("11"),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("110")),
                                      new CRTInner <string>(126, UInt128.Zero.Sub(UInt128.One).Sub(UInt128.One),
                                                            new CRTLeaf <string>(UInt128.Zero.Sub(UInt128.One).Sub(UInt128.One), "stuff"),
                                                            new CRTLeaf <string>(UInt128.Zero.Sub(UInt128.One), "all one or none!")
                                                            )
                                      )
                );

            return(t);
        }
        public void LookupTest()
        {
            // initialize tree
            var t = setupTree();

            // lookup a value; should be "hi!"
            var key   = UInt128.FromZeroFilledPrefix("000010");
            var value = t.Lookup(key);

            Assert.IsTrue(FSharpOption <string> .get_IsSome(value));
            Assert.AreEqual("hi!", value.Value);
        }
        private CRTNode <string> setupTree()
        {
            var t = new CRTRoot <string>(
                new CRTInner <string>(0, UInt128.FromZeroFilledPrefix("0"),
                                      new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("00"),
                                                            new CRTInner <string>(4, UInt128.FromZeroFilledPrefix("00001"),
                                                                                  new CRTLeaf <string>(UInt128.FromZeroFilledPrefix("000010"), "hi!"),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("000011"))
                                                                                  ),
                                                            new CRTInner <string>(3, UInt128.FromZeroFilledPrefix("0010"),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00100")),
                                                                                  new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("00101"))
                                                                                  )
                                                            ),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("01"))
                                      ),
                new CRTInner <string>(1, UInt128.FromZeroFilledPrefix("11"),
                                      new CRTEmptyLeaf <string>(UInt128.FromZeroFilledPrefix("110")),
                                      new CRTLeaf <string>(UInt128.Zero.Sub(UInt128.One), "all one or none!")
                                      )
                );

            return(t);
        }