コード例 #1
0
ファイル: TestPyInt.cs プロジェクト: filmor/pythonnet
        public void ToBigIntegerLarge()
        {
            BigInteger val   = BigInteger.Pow(2, 1024) + 3;
            var        pyInt = new PyInt(val);

            Assert.AreEqual(val, pyInt.ToBigInteger());
            val   = -val;
            pyInt = new PyInt(val);
            Assert.AreEqual(val, pyInt.ToBigInteger());
        }
コード例 #2
0
ファイル: TestPyInt.cs プロジェクト: filmor/pythonnet
        public void ToBigInteger()
        {
            int[] simpleValues =
            {
                0,      1, 2,
                0x10,
                0x123,
                0x1234,
            };
            simpleValues = simpleValues.Concat(simpleValues.Select(v => - v)).ToArray();

            foreach (var val in simpleValues)
            {
                var pyInt = new PyInt(val);
                Assert.AreEqual((BigInteger)val, pyInt.ToBigInteger());
            }
        }