コード例 #1
0
    def test_c_sgi(self):
        ''' Compare identical SGI/MIPS files encoded using both floating-point and integer representations.
        '''

        FMT_SGI_INT = c3d.Reader(Zipload._get(self.ZIP, self.MIPS_INT))
        FMT_SGI_REAL = c3d.Reader(Zipload._get(self.ZIP, self.MIPS_REAL))

        proc_type = 'SGI'
        test_id = '{} format test'.format(proc_type)

        verify.equal_headers(test_id, FMT_SGI_INT, FMT_SGI_REAL, 'INT', 'REAL',
                             False, True)
        verify.data_is_equal(FMT_SGI_INT, FMT_SGI_REAL, 'INT', 'REAL')

        print('SGI FORMAT: OK')
コード例 #2
0
    def test_a_intel(self):
        ''' Compare identical INTEL files encoded using both floating-point and integer representations.
        '''

        print('----------------------------')
        print(type(self))
        print('----------------------------')

        FMT_INTEL_INT = c3d.Reader(Zipload._get(self.ZIP, self.INTEL_INT))
        FMT_INTEL_REAL = c3d.Reader(Zipload._get(self.ZIP, self.INTEL_REAL))

        proc_type = 'INTEL'
        test_id = '{} format test'.format(proc_type)

        verify.equal_headers(test_id, FMT_INTEL_INT, FMT_INTEL_REAL, 'INT',
                             'REAL', False, True)
        verify.data_is_equal(FMT_INTEL_INT, FMT_INTEL_REAL, 'INT', 'REAL')

        print('INTEL FORMAT: OK')
コード例 #3
0
def verify_read_write(zip, file_path, proc_type='INTEL', real=True):
    ''' Compare read write ouput to original read file.
    '''
    A = c3d.Reader(Zipload._get(zip, file_path))

    cpy_mode = 'copy'
    if proc_type != 'INTEL':
        cpy_mode = 'shallow_copy'
    writer = A.to_writer(cpy_mode)

    tmp_path = os.path.join(TEMP, 'write_test.c3d')
    with open(tmp_path, 'wb') as handle:
        writer.write(handle)

    aname = 'Original'
    bname = 'WriteRead'
    test_id = '{} write read test'.format(proc_type)

    with open(tmp_path, 'rb') as handle:
        B = c3d.Reader(handle)
        verify.equal_headers(test_id, A, B, aname, bname, real, real)
        verify.data_is_equal(A, B, aname, bname)
コード例 #4
0
    def test_e_real_formats(self):
        ''' Compare identical files for different processor formats.
            All files are encoded using the floating-point representations.
        '''

        FMT_INTEL_REAL = c3d.Reader(Zipload._get(self.ZIP, self.INTEL_REAL))
        FMT_DEC_REAL = c3d.Reader(Zipload._get(self.ZIP, self.DEC_REAL))
        FMT_SGI_REAL = c3d.Reader(Zipload._get(self.ZIP, self.MIPS_REAL))

        verify.equal_headers('INTEL-DEC INT format test', FMT_INTEL_REAL,
                             FMT_DEC_REAL, 'INTEL', 'DEC', True, True)
        verify.equal_headers('INTEL-SGI INT format test', FMT_INTEL_REAL,
                             FMT_SGI_REAL, 'INTEL', 'SGI', True, True)
        verify.equal_headers('DEC-SGI INT format test', FMT_DEC_REAL,
                             FMT_SGI_REAL, 'DEC', 'SGI', True, True)

        verify.data_is_equal(FMT_INTEL_REAL, FMT_DEC_REAL, 'INTEL', 'DEC')
        verify.data_is_equal(FMT_INTEL_REAL, FMT_SGI_REAL, 'INTEL', 'SGI')
        verify.data_is_equal(FMT_DEC_REAL, FMT_SGI_REAL, 'DEC', 'SGI')

        print('INTEL-DEC-SGI REAL FORMAT COMPARISON: OK')
コード例 #5
0
    def test_d_int_formats(self):
        ''' Compare identical files for different processor formats.
            All files are encoded using the integer representations.
        '''

        FMT_INTEL_INT = c3d.Reader(Zipload._get(self.ZIP, self.INTEL_INT))
        FMT_DEC_INT = c3d.Reader(Zipload._get(self.ZIP, self.DEC_INT))
        FMT_SGI_INT = c3d.Reader(Zipload._get(self.ZIP, self.MIPS_INT))

        verify.equal_headers('INTEL-DEC INT format test', FMT_INTEL_INT,
                             FMT_DEC_INT, 'INTEL', 'DEC', False, False)
        verify.equal_headers('INTEL-SGI INT format test', FMT_INTEL_INT,
                             FMT_SGI_INT, 'INTEL', 'SGI', False, False)
        verify.equal_headers('DEC-SGI INT format test', FMT_DEC_INT,
                             FMT_SGI_INT, 'DEC', 'SGI', False, False)

        verify.data_is_equal(FMT_INTEL_INT, FMT_DEC_INT, 'INTEL', 'DEC')
        verify.data_is_equal(FMT_INTEL_INT, FMT_SGI_INT, 'INTEL', 'SGI')
        verify.data_is_equal(FMT_DEC_INT, FMT_SGI_INT, 'DEC', 'SGI')

        print('INTEL-DEC-SGI INT FORMAT COMPARISON: OK')