示例#1
0
        public void TestClear()
        {
            // Length > 32
            Fingerprint fp = new Fingerprint(65);
            for (int i = 0; i < 65; ++i)
            {
                fp.Touch(i);
                Assert.True(fp.Get(i));
            }
            fp.Clear();
            for (int i = 0; i < 65; ++i)
            {
                Assert.False(fp.Get(i));
            }

            // Length <= 32
            var fp2 = new Fingerprint(6);
            for (int i = 0; i < 6; ++i)
            {
                fp2.Touch(i);
                Assert.True(fp2.Get(i));
            }
            fp.Clear();
            for (int i = 0; i < 6; ++i)
            {
                Assert.False(fp.Get(i));
            }
        }
示例#2
0
        public void TestClear()
        {
            // Length > 32
            Fingerprint fp = new Fingerprint(65);

            for (int i = 0; i < 65; ++i)
            {
                fp.Touch(i);
                Assert.True(fp.Get(i));
            }
            fp.Clear();
            for (int i = 0; i < 65; ++i)
            {
                Assert.False(fp.Get(i));
            }

            // Length <= 32
            var fp2 = new Fingerprint(6);

            for (int i = 0; i < 6; ++i)
            {
                fp2.Touch(i);
                Assert.True(fp2.Get(i));
            }
            fp.Clear();
            for (int i = 0; i < 6; ++i)
            {
                Assert.False(fp.Get(i));
            }
        }
示例#3
0
        public void TestCopyCreation()
        {
            Fingerprint fp1 = new Fingerprint(65);

            fp1.Touch(32);
            Fingerprint fp2 = new Fingerprint(fp1);

            Assert.True(fp2.Get(32));

            // Ensure that the original block array is not shared
            fp1.Touch(64);
            Assert.False(fp2.Get(64));
        }
示例#4
0
        public void TestCreation()
        {
            var fp1 = new Fingerprint(1);

            Assert.Equal(1, fp1.Length);
            Assert.False(fp1.Get(0));

            Fingerprint fp2 = new Fingerprint(33);

            Assert.Equal(33, fp2.Length);
            for (int i = 0; i < 33; ++i)
            {
                Assert.False(fp2.Get(i));
            }
        }
示例#5
0
        public void TestAccessors()
        {
            var fp = new Fingerprint(33);

            Assert.Throws(typeof(IndexOutOfRangeException),
                () => { fp.Get(-1); });
            Assert.Throws(typeof(IndexOutOfRangeException),
                () => { fp.Get(33); });

            Assert.False(fp.Get(31));
            fp.Touch(31);
            Assert.True(fp.Get(31));
            fp.Wipe(31);
            Assert.False(fp.Get(31));

            Assert.False(fp.Get(32));
            fp.Touch(32);
            Assert.True(fp.Get(32));
            fp.Wipe(32);
            Assert.False(fp.Get(32));
        }
示例#6
0
        public void TestAccessors()
        {
            var fp = new Fingerprint(33);

            Assert.Throws(typeof(IndexOutOfRangeException),
                          () => { fp.Get(-1); });
            Assert.Throws(typeof(IndexOutOfRangeException),
                          () => { fp.Get(33); });

            Assert.False(fp.Get(31));
            fp.Touch(31);
            Assert.True(fp.Get(31));
            fp.Wipe(31);
            Assert.False(fp.Get(31));

            Assert.False(fp.Get(32));
            fp.Touch(32);
            Assert.True(fp.Get(32));
            fp.Wipe(32);
            Assert.False(fp.Get(32));
        }
示例#7
0
        public void TestCreation()
        {
            var fp1 = new Fingerprint(1);
            Assert.AreEqual(1, fp1.Length);
            Assert.False(fp1.Get(0));

            Fingerprint fp2 = new Fingerprint(33);
            Assert.AreEqual(33, fp2.Length);
            for (int i = 0; i < 33; ++i)
            {
                Assert.False(fp2.Get(i));
            }
        }
示例#8
0
        public void TestCopyCreation()
        {
            Fingerprint fp1 = new Fingerprint(65);
            fp1.Touch(32);
            Fingerprint fp2 = new Fingerprint(fp1);
            Assert.True(fp2.Get(32));

            // Ensure that the original block array is not shared
            fp1.Touch(64);
            Assert.False(fp2.Get(64));
        }