Esempio n. 1
0
        public void TestSubtract_BigInteger_MinMinus1Nsec_Overflow()
        {
            var @base   = new Timestamp(-9223372036854775808L, 0);
            var operand = 1;

            Assert.Throws <OverflowException>(() => @base.Subtract(operand));
        }
Esempio n. 2
0
        public void TestSubtract_TimeSpan_MinMinus1Tick_Overflow()
        {
            var @base   = new Timestamp(-9223372036854775808L, 99);
            var operand = TimeSpan.FromTicks(1);

            Assert.Throws <OverflowException>(() => @base.Subtract(operand));
        }
Esempio n. 3
0
        public void TestSubtract_BigInteger_MaxPlus1Nsec_Overflow()
        {
            var @base   = new Timestamp(9223372036854775807L, 999999999);
            var operand = -1;

            Assert.Throws <OverflowException>(() => @base.Subtract(operand));
        }
Esempio n. 4
0
        public void TestSubtract_TimeSpan_MaxPlus1Sec_Overflow()
        {
            var @base   = new Timestamp(9223372036854775807L, 0);
            var operand = TimeSpan.FromSeconds(-1);

            Assert.Throws <OverflowException>(() => @base.Subtract(operand));
        }
Esempio n. 5
0
        public void TestSubtract_Timestamp_1Nsec()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = new Timestamp(0L, 1);
            var result  = @base.Subtract(operand);

            Assert.That(result, Is.EqualTo(new BigInteger(1000000000)));
        }
Esempio n. 6
0
        public void TestSubtract_Timestamp_MinMax()
        {
            var @base   = new Timestamp(-9223372036854775808L, 0);
            var operand = new Timestamp(9223372036854775807L, 999999999);
            var result  = @base.Subtract(operand);

            Assert.That(result, Is.EqualTo(new BigInteger(Int64.MinValue) * 1000000000 - new BigInteger(Int64.MaxValue) * 1000000000 - 999999999));
        }
Esempio n. 7
0
        public void TestSubtract_Timestamp_PositiveNegative()
        {
            var @base   = new Timestamp(1L, 2);
            var operand = new Timestamp(-1L, 1);
            var result  = @base.Subtract(operand);

            Assert.That(result, Is.EqualTo(new BigInteger(2000000001)));
        }
Esempio n. 8
0
        public void TestSubtract_Timestamp_MoveDown()
        {
            var @base   = new Timestamp(2L, 1);
            var operand = new Timestamp(1L, 2);
            var result  = @base.Subtract(operand);

            Assert.That(result, Is.EqualTo(new BigInteger(999999999)));
        }
Esempio n. 9
0
        public void TestSubtract_BigInteger_MoveDown()
        {
            var @base   = new Timestamp(1L, 0);
            var operand = 2;
            var result  = @base.Subtract(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(0));
            Assert.That(result.NanosecondsPart, Is.EqualTo(999999998));
        }
Esempio n. 10
0
        public void TestSubtract_BigInteger_Minus1Nsec()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = -1;
            var result  = @base.Subtract(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(1));
            Assert.That(result.NanosecondsPart, Is.EqualTo(2));
        }
Esempio n. 11
0
        public void TestSubtract_TimeSpan_MoveDown()
        {
            var @base   = new Timestamp(1L, 99);
            var operand = TimeSpan.FromTicks(1);
            var result  = @base.Subtract(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(0));
            Assert.That(result.NanosecondsPart, Is.EqualTo(999999999));
        }
Esempio n. 12
0
        public void TestSubtract_TimeSpan_Minus1Tick()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = TimeSpan.FromTicks(-1);
            var result  = @base.Subtract(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(1));
            Assert.That(result.NanosecondsPart, Is.EqualTo(101));
        }
Esempio n. 13
0
        public void TestSubtract_TimeSpan_Same()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = TimeSpan.Zero;
            var result  = @base.Subtract(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(1));
            Assert.That(result.NanosecondsPart, Is.EqualTo(1));
        }