
    b;
                     T    d dl mZ d dlmZ d dlZd Zd Zd Z G d de          ZdS )	    )TestCase)dsdb_dnsNc                 d    | dk    r| S | dk    rdS | dk    rdS | dz  } | dz  } t          |           S )N    r   l    !l
 g    cA)int)ts    6/usr/lib/python3/dist-packages/samba/tests/dsdb_dns.pyunix2nttimer      sL    BwwM}AvvqAHAq66M    c                 Z    t          |           }|dk     r|dz  }|t          d          z  S )Nr   l               Ј B)r   r   )r	   nts     r
   unix2dns_timestampr   #   s0    	QB	Avv
gVr   c                 T    | t          d          z  }|dk    rt          d          |S )Nr   l            znt time won't fit this)r   OverflowError)tsr   s     r
   timestamp2nttimer   +   s/    	c&kk	B	W}}4555Ir   c                       e Zd Zd Zd ZdS )DsdbDnsTestCasec                     g d}|D ];}t          |          }t          j        |          }|                     ||           <d S )N)i^`   r   r   i   @)r   r   unix_to_dns_timestampassertEqual)self	unixtimesr	   expectedresults        r
   test_unix_to_dns_timestampz*DsdbDnsTestCase.test_unix_to_dns_timestamp3   sd    " " "	  	/ 	/A)!,,H3A66FVX....	/ 	/r   c           	         dddddt          d          t          d          dz   g}|D ]}d}	 t          |          }n# t          $ r d}Y nw xY w	 t          j        |          }n*# t
          $ r |                     |d	| d
           Y cw xY w|                     |d	| d           |                     ||           d S )Niɵ r   r   l    r   gaտAFTz
timestamp z should not overflowz should overflow)	r   r   r   r   dns_timestamp_to_nt_time
ValueError
assertTrueassertFalser   )r   
timestampsr	   	overflowsr   r   s         r
   test_dns_timestamp_to_nt_timez-DsdbDnsTestCase.test_dns_timestamp_to_nt_time?   s!   ##,--,--1
  	/ 	/AI!+A..  ! ! ! 			!!:1==   	+O+O+O+OPPP Y(HQ(H(H(HIIIVX....	/ 	/s!   >AAA&&$BBN)__name__
__module____qualname__r   r'    r   r
   r   r   2   s2        
/ 
/ 
// / / / /r   r   )	samba.testsr   sambar   timer   r   r   r   r+   r   r
   <module>r/      s   " !                 
 
 
    $/ $/ $/ $/ $/h $/ $/ $/ $/ $/r   