Esempio n. 1
0
        public void RObjectTest()
        {
            RNumber  rn = new RNumber(1);
            RLogical rl = new RLogical(false);
            RString  rs = new RString("abc");

            RVector <RString> rvs = new RVector <RString>(RMode.Character, 1);
            RVector <RNumber> rvn = new RVector <RNumber>(RMode.Numeric, 2);

            rs.IsString.Should().BeTrue();
            rn.IsString.Should().BeFalse();
            rl.IsString.Should().BeFalse();

            rs.IsNumber.Should().BeFalse();
            rn.IsNumber.Should().BeTrue();
            rl.IsNumber.Should().BeFalse();

            rs.IsScalar.Should().BeTrue();
            rn.IsScalar.Should().BeTrue();
            rl.IsScalar.Should().BeTrue();

            rs.IsBoolean.Should().BeFalse();
            rn.IsBoolean.Should().BeFalse();
            rl.IsBoolean.Should().BeTrue();

            rvs.IsScalar.Should().BeTrue();
            rvn.IsScalar.Should().BeFalse();

            rvs.IsString.Should().BeTrue();
            rvn.IsNumber.Should().BeFalse();
        }
Esempio n. 2
0
        public void RLogicalTest()
        {
            RLogical rlTrue1  = new RLogical(true);
            RLogical rlTrue2  = new RLogical(true);
            RLogical rlFalse1 = new RLogical(false);
            RLogical rlFalse2 = new RLogical(false);

            rlTrue1.Mode.Should().Be(RMode.Logical);
            (rlTrue1 == true).Should().BeTrue();
            (rlTrue1 != true).Should().BeFalse();
            (rlTrue1 == false).Should().BeFalse();
            ((bool)rlTrue1).Should().BeTrue();
            rlTrue2.Should().Be(rlTrue1);

            rlFalse1.Mode.Should().Be(RMode.Logical);
            (rlFalse1 == false).Should().BeTrue();
            (rlFalse1 != false).Should().BeFalse();
            (rlFalse1 == true).Should().BeFalse();
            ((bool)rlFalse1).Should().BeFalse();
            rlFalse2.Should().Be(rlFalse1);
            rlTrue1.Should().NotBe(rlFalse1);

            (rlFalse1 == rlFalse2).Should().BeTrue();
            (rlFalse1 != rlTrue1).Should().BeTrue();
            (rlTrue1 == rlTrue2).Should().BeTrue();

            ((bool)(rlFalse1 & rlFalse2)).Should().BeFalse();
            ((bool)(rlFalse1 & rlTrue1)).Should().BeFalse();
            ((bool)(rlFalse1 | rlFalse2)).Should().BeFalse();
            ((bool)(rlFalse1 | rlTrue1)).Should().BeTrue();

            ((bool)!rlFalse1).Should().BeTrue();
            ((bool)!rlTrue1).Should().BeFalse();
        }
Esempio n. 3
0
        public void RVectorTest()
        {
            var rv = new RVector <RLogical>(RMode.Logical, 2);

            rv.Length.Should().Be(2);
            rv.Mode.Should().Be(RMode.Logical);
            rv.IsBoolean.Should().BeFalse();

            rv[0] = new RLogical(false);
            rv[1] = new RLogical(true);

            rv[0].Should().Be(RLogical.FALSE);
            rv[1].Should().Be(RLogical.TRUE);

            rv = new RVector <RLogical>(RMode.Logical, 1);
            rv.IsBoolean.Should().BeTrue();
        }