コード例 #1
0
        public void AntecedentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(1, ComparisonKind.Equal, 1.0);

            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);
            var a4 = new Antecedent(0, ComparisonKind.Equal, 1.0);

            bool a12 = a1.Equals(a2);
            bool a34 = a3.Equals(a4);
            bool a14 = a1.Equals(a4);

            Assert.IsFalse(a12);
            Assert.IsFalse(a34);
            Assert.IsTrue(a14);

            int hash1 = a1.GetHashCode();
            int hash2 = a2.GetHashCode();
            int hash3 = a3.GetHashCode();
            int hash4 = a4.GetHashCode();

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash3, hash4);
            Assert.AreEqual(hash1, hash4);
        }
コード例 #2
0
        public void IsInconsistentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);

            var rule1 = new DecisionRule(0, a1);
            var rule2 = new DecisionRule(0, a2);
            var rule3 = new DecisionRule(0, a3);

            bool a12 = rule1.IsInconsistentWith(rule2);
            bool a13 = rule1.IsInconsistentWith(rule3);

            Assert.IsFalse(a12);
            Assert.IsFalse(a13);
        }