U _c@s(ddlZddlmZddlZddlZddlZddlZejjZ de Z e dZ dZ dZ ddde e d?ddgZd Zede D]Zeeded>Zqz[ed d eDd d eD7ZejjZejjZejjZejjZdedeedZd dZddZGdddejZ e!dkr$e"dS)N)supportiFlUU*UU*l*UU*UU cCsg|] }|qSr.0xrr&/usr/lib64/python3.8/test/test_long.py r cCg|] }| qSrrrrrr r r cCstjjd}tjj|}d|>}ddddddddg}|dkr@dS|dkrTt|  S||}|dkrr|| >n||?t|d|>@B}|||d@7}|||k|krtd|d dkr|d dtjjkst|d|tjj kstt t ||S) z9 Correctly-rounded integer-to-float conversion. rrrz%integer too large to convert to floatr) sys float_infomant_digmax_exp int_to_float bit_lengthZbool OverflowErrorAssertionErrormaxmathldexpfloat)nZ PRECISIONZ SHIFT_MAXZQ_MAXZROUND_HALF_TO_EVEN_CORRECTIONshiftqrrr r's     ,$rcCs ||Adk}t|t|}}|s*td|t|kr>td||}|dkrf|d||ks|dkr|d| |kr|d7}t|tt}|t| d>|t|d>}}t||\}}d||ksd||kr|ddkr|d7}t ||}|r| S|S)z-Correctly-rounded true division for integers.rzdivision by zeroz)int/int too large to represent as a floatrr) absZeroDivisionErrorDBL_MIN_OVERFLOWrrr DBL_MIN_EXP DBL_MANT_DIGdivmodrr)abZnegativedexpr rresultrrr truedivUs   2 $ r-c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZejdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0ZdYd2d3Zejd4d5Zd6d7Zd8d9Z ej!d:d;Z"ej!ej#e$j%d<d=d>d?d@dAZ&dBdCZ'ej!ej#e$j%dDdEd>d?dFdGZ(dHdIZ)dJdKZ*dLdMZ+dNdOZ,dPdQZ-dRdSZ.dTdUZ/dVdWZ0dXS)ZLongTestcCs||d|t}|td}d}d}tttddB}||kr|d?d}t|||}|d|koxtkn||}||>}|d@r|d|>dB}tttd}q@|||ko|kntdkr| }|S)Nrrr?)Z assertGreaterSHIFTintrandomZmin assertTrue)selfndigitsZnbits_hiZnbits_loanswerZnbitsr+bitsrrr getran{s&    zLongTest.getrancCs<d}t|D]}|t>tdtB}q tdkr8| }|S)Nrr/)ranger0r2ZrandintMASK)r5r6irrr getran2s   zLongTest.getran2c Cs|j}|j||dt||\}}||||}}||||}} ||| d|||d|||d|||||d|dkr|d|ko|kndn |||kodkndW5QRXdS)Nr yzmultiplication does not commutez(divmod returns different quotient than /z#divmod returns different mod than %zx != q*y + r after divmodrzbad mod from divmod) assertEqualsubTestr&r3) r4r r>eqr r+Zq2Zr2ZpabZpbarrr check_divisions   "zLongTest.check_divisioncCsttdtdttttd}|td|D]2}||}|D]}||pXd}|||qHq6|dd|dd|dd |d d |d d |dd|dd|dd|dd|dd|dd|dddS)Nrl!Us/w3alZW3al+Q@{dB]OlNlOOlNlteo%gqCgxrrr test_divisionsB      zLongTest.test_divisionc Csttddttttd}|tdtdgdd|D}|D]~}d|>d}|D]h}||krjq\|j||dFd|>d}||}d||>d|>d|>d}|||W5QRXq\qHdS)Nr dcSsg|] }|tqSr)r0)rdigitrrr r r z+LongTest.test_karatsuba..)abitsbbits)rEr9rGextendr@r?) r4rIr7rQr'rRr(r r>rrr test_karatsubas*   zLongTest.test_karatsubac Cs|j}|j|d||d@d||dB|||dA|||d@|||dBd||dA|||||||@||||B||||Ad|||@d|||Bd|||Ad|| d||| |dW5QRXtdtD]}d|}|j|||dn|||>|?||||||?|||||>||| @||?|>||| @||d@W5QRXq dS)N)r rrrr)r rp2)r?r@r9r0)r4r rArrUrrr check_bitop_identities_1s2z!LongTest.check_bitop_identities_1c Cs|j}|j||d|||@||@|||B||B|||A||A|||A|A||||@||B|||B||@|||A||B||@@|||A||@||@B|||A||B||B@W5QRXdS)Nr=r?r@)r4r r>rArrr check_bitop_identities_2sz!LongTest.check_bitop_identities_2c Cs|j}|j|||d|||@|@|||@@|||B|B|||BB|||A|A|||AA||||B@||@||@B||||@B||B||B@W5QRXdS)N)r r>zrW)r4r r>rYrArrr check_bitop_identities_3sz!LongTest.check_bitop_identities_3c CstD]}||qtdtd}|D]T}||}|||D]6}||}|||||||||dqBq&dS)Nrr)specialrVr9rFr8rXrZ)r4r rIrJrKr>rrr test_bitop_identitiess     zLongTest.test_bitop_identitiescCsg}d}|dkrd| }}|r>t||\}}|t|q||pNdg}dd|ddddd|dd d |DS) Nrr-Z0bZ0oZ0x)rrNcss|]}d|VqdS)Z0123456789abcdefNrrr;rrr Z 1sz'LongTest.slow_format..)r&rHr1ZreverseZjoin)r4r baserIsignr+rrr slow_format%s   zLongTest.slow_formatc CsdtfdtfdtfdtfdtffD]n\}}||}|j||jd|||}|||W5QRX|j|d|t |d|W5QRXq"dS)Nrr_rNr`)r mapper)gotr) binZoctstrreprZhexr@__name__rdr?r1)r4r rbrerfexpectedrrr check_format_13s* zLongTest.check_format_1cCsNtD]}||qtdD],}tdtdD]}||}||q.qdS)NrNr)r[rlr9rFr8)r4r r;rJrrr test_format<s    zLongTest.test_formatc Cs$ddddfg}|D]l\}}dD]^}dD]T}|||}|}|dkrR|tk rR| }z|t||Wq(tk rzYq(Xq(q q|ttd|ttd |ttd |ttd |ttd d |ttdd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|td dd|ttd!d|ttd"dd#d$d%d&d'd(d)d*d+d,dd,d g }|D]} |ttd-| q|ttd.dS)/N)Z100000000000000000000l Fx:^VZe10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000rNrO)r^z+r])r^ z z r]Z123LZ123lZ0Lz-37LZ0x32Lr`Z1Liii+Z000rZ0o123iSZ0x123i#Z0b100rz 0O123 z 0X123 z 0B100 Z0z+0z-0Z00Z08z-012395isilllrZ42uこんにちは) ValueErrorr?r1 assertRaises) r4ZLLZsvrcZprefixZssZvvZ invalid_basesrbrrr test_longDsb    zLongTest.test_longcCsBGddd}|tt|Gddd}|t|ddS)Nc@eZdZddZdS)z*LongTest.test_conversion..JustLongcSdSN*rr4rrr __long__z3LongTest.test_conversion..JustLong.__long__N)rj __module__ __qualname__r|rrrr JustLongsrc@seZdZddZddZdS)z+LongTest.test_conversion..LongTrunccSrxryrr{rrr r|r}z4LongTest.test_conversion..LongTrunc.__long__cSrx)Nrr{rrr __trunc__r}z5LongTest.test_conversion..LongTrunc.__trunc__N)rjr~rr|rrrrr LongTruncsrr)rt TypeErrorr1r?)r4rrrrr test_conversion}szLongTest.test_conversioncCslz t|}Wntk r$d}YnXz t|}Wntk rJd}YnXd|||}||||dS)NoverflowzAError in conversion of integer {} to float. Got {}, expected {}.)rrrformatr?)r4rZactualrkZmsgrrr check_float_conversions    zLongTest.check_float_conversionc Csddddddddd d d d g }|D](}|t|||t| | q d D]B\}}tdD]0}|ttd|d|d|d|q^qNdD]B\}}tdD]0}|ttd|d |d|d |qqtt}dt}||d}|t|t|t|dt|t|dt|tt||td|t |tt| |tt|d|tt||tt|d|ttd|d|ttd||tt||tdD]b}d|dd}d|d}|tt||d|d}d|d}|tt||q|d||d|d||d|d||dd|dd|||g }||tddD].}tddD]}| d|d|qq|D]} | | | | qdS)Nrrrlllllllll)rr)rrrDrrrrMr)rrr_r))rrr)rrrrr)rr_r)r_r_) r_)rNr_) )rr) r)rCr`)rr`rOlr_i5) r?rr9r1DBL_MAX DBL_MAX_EXPrtrrSrHr) r4Z exact_valuesr r>ZpZ int_dbl_maxZ top_powerZhalfwayZ test_valuesvaluerrr test_float_conversions|   0  0        zLongTest.test_float_conversioncCsrdD]}|tt||qd}dd>}| }|||td}dD]}|tt||qB|t|t|ddS)N)gr?@AX123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345ri0u)hugemhugeshuger)$ float(huge) float(mhuge)z complex(huge)zcomplex(mhuge)zcomplex(huge, 1)zcomplex(mhuge, 1)zcomplex(1, huge)zcomplex(1, mhuge)z 1. + hugez huge + 1.z 1. + mhugez mhuge + 1.z 1. - hugez huge - 1.z 1. - mhugez mhuge - 1.z 1. * hugez huge * 1.z 1. * mhugez mhuge * 1.z 1. // hugez huge // 1.z 1. // mhugez mhuge // 1.z 1. / hugez huge / 1.z 1. / mhugez mhuge / 1.z 1. ** hugez huge ** 1.z 1. ** mhugez mhuge ** 1.zmath.sin(huge)zmath.sin(mhuge)zmath.sqrt(huge)zmath.sqrt(mhuge)z(float(shuge) should not equal int(shuge))r?rr1rrtrevalZassertNotEqual)r4r rrr namespacetestrrr test_float_overflowszLongTest.test_float_overflowcCsttj}ttddddgD]@}d|}t|}|||||}t|}|||q"dd> ddfD]$}|ttj||ttj|qtdS)NrNrO'rrr) rlog10erEr9ZassertAlmostEquallogrtrs)r4ZLOG10Er*rrrkrZbadrrr test_logss    zLongTest.test_logsc s|j}Gfdddddddddd g}d D]B}||d|d ||d |dt|d t|t|d gq.|dd d tjttjgtd }|dd d d d>|d ||d g|dd|D|D]}|}|D]}|}||k||k}|j|||d||k||k} ||| |||k|dk|||k|dk|||k|dk|||k|dk|||k|dk|||k|dkW5QRXqqdS)NcsHeZdZddZfddZddZddZd d Zd d Zd dZ dS)z)LongTest.test_mixed_compares..Ratc Ss,t|tr||_d|_nt|trtt|\}}|dksZd|krTdksZntd}d}|rt ||}t|}||?dkst||>|B}||8}d|krdksnt||8}qb|dkr||>}d}n|}d| >}|dkr| }||_||_t|t||ks(tn t d|dS)Nrrr/rirzcan't deal with %r) isinstancer1rr)rrZfrexpr!rrr) r4rZfrZCHUNKZtoprPrr)rrr __init__s6   "    z2LongTest.test_mixed_compares..Rat.__init__cs<t|s|}|j|j|j|j}}||k||kS)N)rrr))r4otherr r>Ratrr _cmp__Fs z0LongTest.test_mixed_compares..Rat._cmp__cSs||dkSNrrr4rrrr __eq__Kr}z0LongTest.test_mixed_compares..Rat.__eq__cSs||dkSrrrrrr __ge__Mr}z0LongTest.test_mixed_compares..Rat.__ge__cSs||dkSrrrrrr __gt__Or}z0LongTest.test_mixed_compares..Rat.__gt__cSs||dkSrrrrrr __le__Qr}z0LongTest.test_mixed_compares..Rat.__le__cSs||dkSrrrrrr __lt__Sr}z0LongTest.test_mixed_compares..Rat.__lt__N) rjr~rrrrrrrrrrrr rs( rrgMbP?gGz?rg?g@xDgZbti)gBgCg@Cg333333?rri NcSr rrrrrr r ar z0LongTest.test_mixed_compares..)r r>Rcmp)r?rSr1rmaxsizerr@) r4rAZcasesZtr ZRxr>ZRyrZxycmprrr test_mixed_comparess69  $ zLongTest.test_mixed_comparescCs|tddd|tddd|tddd|tddd|tdd d |td d d |tdd d|td d d|tddd|td dd|tddd|td dd|tddd|td dd |tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|td dd |td dd |ttd!d"dd!|ttd!d"dd#|ttd!d" dd$|ttd!d" dd%|ttd&d'|td&d(d)|td&d*d+|tdd,d|td d,d |tdd,d-|tdd,d.|tdd/d-|tdd/d.|tdd0d1|tdd0d.|tdd2d3|tdd2d.|ttd&d4|td&d5d6|tdd7d8|td d7d9|tdd7d:|tdd7d;|tdd<d:|tdd<d;|tdd=d>|tdd=d;|tdd?d@|tdd?d;|ttd&dA|tdBdCdD|ttddE|ttddF|ttddG|ttddH|tdItddJ|tdItddK|tdItddL|tdItddM|tdNtddO|tdPtddQdRdSttdTtdUdDdVdSttdWtdXdDD]j}|dYkr|ttdZ||ttd||ttd ||ttd[d\||ttd[d\ |qd]D].}d^D]"}|t||tt||qXqPdS)_Ni[r)Z 123456789z,z 123,456,789_Z 123_456_789rr]Z1rz-1z-3z 1z -1z+3z +1z 3rnz 1rDr Z3ZXiZ4d2i.z-4d2Z8xz 4d2z -4d2Zber`ZBEz-bez-BEIz,xZ_xZ 4996_02d2Z_XZ 4996_02D2ZoZ2322z-2322z-oz oz 2322z+oz+2322z,oZ_oZ 111_4540_1322r(Z11z-11Z 10011010010z -10011010010z-bz bz 10011010010z+bz +10011010010z,b90Z_bZ11_0000_0011_1001z1.3Z_cz,cz+czCannot specify bothz_,z,_z_,dz,_dzCannot specify ',' with 's'z,szCannot specify '_' with 's'Z_scSg|] }t|qSrZchrrrrr r r z+LongTest.test__format__..r'rYcSrrrrrrr r r ZAZZzbcdoxXeEfFgGn%rrrOzeEfFgG%)rrrrOri.i) r?rr1rtrsZassertRaisesRegexr9Zordr)r4Z format_specrrrr test__format__qs   zLongTest.test__format__cCs:|tttd|tttd|tttddS)NZinfz-infZnan)rtrr1rrsr{rrr test_nan_infszLongTest.test_nan_infc Cs|tdd}W5QRX|dd|dd|dd|dd|dd|dd|dd|dddS)NrrrDrrrtr"r?r4rrrr test_mod_divisions        zLongTest.test_mod_divisioncCsdd>}| }|||d|||d|||d|||d|d|d|d|d|d|d|d|d|d||d?|d|d||d?|d|d||d?|d|d||d?|d|||d>d |d ||d ||d }d D]}|tt||q4d D]"}t||}||dd|qPdD]}|tt||qxdS)Nri@rrrigԄ@gԄr/i@B)rr)rrzhuge / 1zhuge / 2z huge / -1z huge / -2z mhuge / 100z mhuge / 200)z1 / hugez2 / hugez -1 / hugez -2 / hugez 100 / mhugez 200 / mhugezexpected underflow to 0 from %r)zhuge / 0z mhuge / 0)r?rtrrr")r4rrrrZ underflowr,Zzerorrr test_true_divisions4  zLongTest.test_true_divisionc Cs|tdd}W5QRX|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dddS)NrrrrDrrrrrrr test_floordivs            zLongTest.test_floordivTc Cs|r"tt|t|dtkr"dSztt||}Wn.tk rLd}Yntk rbd}YnXzt||}Wn.tk rd}Yntk rd}YnX|||d||||dS)zVerify that the result of a/b is correctly rounded, by comparing it with a pure Python implementation of correctly rounded division. b should be nonzero.rNrZ zerodivisionz7Incorrectly rounded division {}/{}: expected {}, got {}) rr!r%rir-rr"r?r)r4r'r(Z skip_smallrkrfrrr check_truedivs(    zLongTest.check_truedivcCs|dd|dd|dd|dd|dd|ddtd|dd dtt|ddd d |d d d ddtttttf}|D]p}t|d|dD]X}|ddt|dddt| d|ddt|dddt| dqqddd ddd d ddddddd f D]B}tddD]0}||t||||t|| qLq>tdD]6}|dtddddd|dtdq|dd|d d!td"D]6}|d|dd||d|d|dqddd#d d$d%dd&dd d ddddddd fD]0}tddD]}|dt|||qVqHtd'd(D]}||dd)qd*dd dd"fD]n}td"D]^}td|}t|d|d} ||| || | ||| || | qqtd+D]r} td"} tdd"} td| } tdd| }|| ||| | || ||| | q&dS),Ni{ri8rDrige~rriNFrOíl90riQri0&iCrrriii)2rNi lE,J_lJbrrr_r` ii4ld( r) rrr%r$r9rr#r2 randrange)r4Zbasesrbr*Zmrr;ZMr'r(rZa_bitsZb_bitsr r>rrr $test_correctly_rounded_true_division8s     *. "            z-LongTest.test_correctly_rounded_true_divisionc Cs|tdd>W5QRX|tddd> >W5QRX|tdd?W5QRX|tddd> ?W5QRXdS)Nrzrrr)rtrsr{rrr test_negative_shift_counts    z"LongTest.test_negative_shift_countc Csr|dd|dd|tdd>W5QRX|ddd>>d|tddd> >W5QRXdS)Nrrrr)r?rtrsr{rrr test_lshift_of_zeros    zLongTest.test_lshift_of_zerocCs,|dtj>d|dtjd>ddS)Nrrr?rrr{rrr test_huge_lshift_of_zerosz!LongTest.test_huge_lshift_of_zerorg?F)ZmemuseZdry_runcCs$|dtjd>dd>tj>dS)Nrrr)r4sizerrr test_huge_lshiftszLongTest.test_huge_lshiftcCs,|ddd>?d|ddd>?ddS)Nrzrrrir)r?r{rrr test_huge_rshiftszLongTest.test_huge_rshiftg?cCsJdd>dtj>}||tjd?dd>d||tjd?ddS)NrrrirMrr)rrr?)r4rrrrr test_huge_rshift_of_hugesz!LongTest.test_huge_rshift_of_hugecCstddD]}|||d|||d|||d|||d|||d@|||dB|||dA||||||d||tt||||d>d?t|q d}|||d|d|ddS)Nrirrrrl)r9assertIsr1rh)r4r;rrr test_small_intsszLongTest.test_small_intsc Csd}tddD]}|}||tt|d|dkrl|d|dt|kobd|knn ||d|dkr||dt t t|t d|q|dd|dd|dd|dd|d dd D]}d|}||d||d|||||d|| |d||d|d|| d|dqdS) Ng|=iiz-0brrrrr) rrDrr`riri!i?i@i) r9rr?lenrgZlstripr3r!rZfloorr)r4Ztinyr kr;r'rrr test_bit_lengths00   zLongTest.test_bit_lengthcCsddddddddddddddddddddd}tdddD]H}|D]:\}}t||d}||}||||t|tqFq:|tdd d |td d d |td d d |tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tddd|tddd|td dd!|td d d"|td dd#|td d$d%|td d&d'|td d(d)|td d*d+|td d,d-|td d.d/|td d0d1|td d2d|td d3d|td d4dtddD]@}td|d5d}d|d6}||||t|tqtd7D]H}tdD]8} td8d9} t| |}||| |t|tqqd:d;ddddfD]} |td?| d?qVtdD]6} td8d9} t| }||| |t|tqxd@} | D]} | t tdA| qdS)BNrrNr)rrrrDrrMrrr_rrNrrrrCrr`riiiirijri8ikriiiri1ri3rOiirrii,iԡriiil!l !l~!l!rl !rl`!il!rl'!ilz+ilv|orl,GxiiiiFirMirrorprqrrri{)ZbrianryrD) r9itemsZroundr?rtyper1r2rrtr)r4Z test_dictZoffsetrrurfrkZexpectrr;r Zhuge_nZ bad_exponentsrrrr test_rounds            zLongTest.test_roundcsd0fdd }dddddd d d d d dddddddd}||dddddddddd dddd dd ddddd}||d ddddd ddddd!d"d#d$ }||dddddd dddd dd"d%d$ }||d ddjtd&jd'dddjtd&jd'dddjtd&jd'd ddjtd&jd'd ddjtd(jd)dddjtd(jd)d ddd*d*dd+d'd,dd-d*d,dd.d(jd,dddd/td'jd*ddS)1NFc sn|D]`\}}z |jt|||d|Wqtk rf}ztd||||W5d}~XYqXqdS)Nsignedz7failed to convert {0} with byteorder={1} and signed={2})rr?to_bytesr ExceptionrrtestsZ byteorderrrrkZerrr{rr check>s z%LongTest.test_to_bytes..checks)rrrrbigTrr}little) rrrrrrrr rrrrrrMsssF)rtrrr?)r4rtests1tests2tests3tests4rr{r test_to_bytes=s   zLongTest.test_to_bytesc sd3fdd }dddddddddd d d d d dddddddd}||ddddddddddddd d d d d dddddddd}||ddddddd dddddddd }||ddddddd dddddddd }||dddGd d!d!t}t|d"d||d#ddt|jd"ddd||jd#ddddt|d"d||d#ddt|jd"ddd||jd#ddddtjdddgddddtjd$ddddtjtd%ddddtjtd%ddddtjtd&d%ddddtjtd%ddddt tjdgdt tjdgd't tjdgd(t tjd)dt tjd*dt tjddt tjdddt |jd)dt |jd*dt |jddt tjdddGd+d,d,t}|d#d}t|||d-Gd.d/d/t} | d#d}t|| |dt |d0d1d2dS)4NFc sj|D]\\}}ztj|||d|Wqtk rb}ztd||||W5d}~XYqXqdS)Nrz9failed to convert {0} with byteorder={1!r} and signed={2})rr?r1 from_bytesrrrrr{rr rs z'LongTest.test_from_bytes..checkrrrrrrrrrrrrrrr r r )rrrr}rrrrrrrrrrrrrrrrr Tr)rrr"rr}rrrrrrr rrrr}rrrrrrrrr) rrrrrrrrrrr) rrrrrrr}rrrrc@ eZdZdS)z'LongTest.test_from_bytes..myintNrjr~rrrrr myintr%rr)rrrrZBzbigzlittler^zc@rw)z(LongTest.test_from_bytes..myint2cSst||dS)Nr)r1__new__)clsrrrr r'&r}z0LongTest.test_from_bytes..myint2.__new__Nrjr~rr'rrrr myint2%r&r*rc@rw)z(LongTest.test_from_bytes..myint3cSs d|_dS)Nbar)foo)r4rrrr r.r}z1LongTest.test_from_bytes..myint3.__init__N)rjr~rrrrrr myint3-r&r-r,Znoner+r) r1rrr!r?Z bytearrayarrayZ memoryviewrtrsrZgetattr) r4rrrrrr%r*r;r-rr{r test_from_bytess&         zLongTest.test_from_bytescsFGdddtfddtdD}tt|D]}||dq0dS)Nc@seZdZdddZdS)z.IntegerrcSst||}d|_|S)Nr,)r1r'r,)r(rr4rrr r';s zDLongTest.test_access_to_nonexistent_digit_0..Integer.__new__Nrr)rrrr Integer:r&r1csg|] }dqSr0rrar1rr r @r z?LongTest.test_access_to_nonexistent_digit_0..rr)r1r9Zmapr?)r4Zintegersrrr2r "test_access_to_nonexistent_digit_06sz+LongTest.test_access_to_nonexistent_digit_0cCs@dD]6}dD],}|t||>t|t||?tq qdS)N)TF)rr)r?rr1)r4rrrrr test_shift_boolDszLongTest.test_shift_boolc CsGdddt}ddddtjddd|d g}|D]H}|\}}|||ft|df|t|t|t|tq2dS) Nc@r#)z-LongTest.test_as_integer_ratio..myintNr$rrrr r%Lr&r%rNrrrTFrz)r1rrZas_integer_ratior?r)r4r%rrZ numeratorZ denominatorrrr test_as_integer_ratioKs zLongTest.test_as_integer_ratioN)T)1rjr~rr8r<rBrLrTrVrXrZr\rdrlrmrvrrrZrequires_IEEE_754rrrrrrrrrrrrrZ cpython_onlyrZ bigmemtestrrrrrrrrr r/r3r4r5rrrr r.ss`'    9 E\a"  [     "Jcr.Z__main__)#Zunittestrrrr2rr.Zint_infoZbits_per_digitr0ZBASEr:rGrFr[rUr9r;rHrrrrrZmin_expr$rr%r#rr-ZTestCaser.rjZmainrrrr ZsH   .l