File: test_mpz_to_from_binary.txt

package info (click to toggle)
python-gmpy2 2.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,628 kB
  • ctags: 1,123
  • sloc: ansic: 21,036; python: 5,846; makefile: 163
file content (18 lines) | stat: -rw-r--r-- 419 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Testing of gmpy2 mpz to_binary and from_binary
----------------------------------------------

    >>> import gmpy2
    >>> from gmpy2 import mpz,to_binary,from_binary

Test
----

    >>> x=mpz(1);x==from_binary(to_binary(x))
    True
    >>> x=mpz(0);x==from_binary(to_binary(x))
    True
    >>> x=mpz(-1);x==from_binary(to_binary(x))
    True
    >>> x=mpz(123456789123456789);x==from_binary(to_binary(x))
    True