Пример #1
0
        public void GetClosestDistance_Ok()
        {
            var n1       = new NodeId("5825da3d2275be487d9987f3e792a3d889005d43");
            var n2       = new NodeId("5825da3d2275be487d9987f3e792a3d889005d43");
            var distance = NodeId.GetDistance(n1, n2);

            Assert.Equal("0000000000000000000000000000000000000000", distance.ToString());
        }
Пример #2
0
        public void GetDistance_Test1()
        {
            // d(x,y) = d(y,x)
            var x = new NodeId("5825da3d2275be487d9987f3e792a3d889005d43");
            var y = new NodeId("da39a3ee5e6b4b0d3255bfef95601890afd80709");

            var d1 = NodeId.GetDistance(x, y);
            var d2 = NodeId.GetDistance(y, x);

            Assert.Equal(d1.ToString(), d2.ToString());
        }
Пример #3
0
        public void GetDistance_Test2()
        {
            // d(x,y) + d(y,z) >= d(x,z)
            var x = new NodeId("5825da3d2275be487d9987f3e792a3d889005d43");
            var y = new NodeId("da39a3ee5e6b4b0d3255bfef95601890afd80709");
            var z = new NodeId("38a400e4aebf80b93fcd9c18bc7ebbd5e8b1a93f");

            var d1 = NodeId.GetDistance(x, y);
            var d2 = NodeId.GetDistance(y, z);
            var d3 = NodeId.GetDistance(x, z);

            Assert.True((d1 ^ d2) >= d3);
        }