示例#1
0
def test_median_histogram():

    with open('median_histogram.in.test', 'r') as test_in, \
      open('median_histogram.out', 'w') as test_out:

        in_data = convert.binstr_to_bin(test_in.readline().replace('\n', ''))
        out_minimum, out_median, out_maximum, out_ready = arch_median_histogram(
            7, 1, in_data)
        test_out.write(convert.bin_to_binstr(out_minimum) + '\n')
        test_out.write(convert.bin_to_binstr(out_median) + '\n')
        test_out.write(convert.bin_to_binstr(out_maximum))
def test_data_proxy():

    with open('data_proxy.in.test', 'r') as test_in, \
         open('data_proxy_kernel.out', 'w') as test_kernel_out, \
         open('data_proxy_image.out', 'w') as test_image_out:

        for line in test_in.readlines():
            in_data = convert.binstr_to_bin(line.replace('\n', ''))
            out_kernel_write, out_image_write, out_kernel, out_image = arch_data_proxy(
                1, in_data)
            if out_kernel_write:
                test_kernel_out.write(convert.bin_to_binstr(out_kernel) + '\n')
            if out_image_write:
                test_image_out.write(convert.bin_to_binstr(out_image) + '\n')
def test_priority_decoder():

    with open('priority_decoder.in.test', 'r') as test_in, \
         open('priority_decoder.out', 'w') as test_out:

        in_value = convert.binstr_to_bin(test_in.readline().replace('\n', ''))
        out_values = arch_priority_decoder(1, in_value)
        test_out.write(convert.bin_to_binstr(out_values))
def test_priority_encoder():

    with open('priority_encoder.in.test', 'r') as test_in, \
         open('priority_encoder.out', 'w') as test_out:
        
        in_histogram = convert.binstr_to_bin(test_in.readline().replace('\n', ''))
        for gen_lookup in ['min', 'med', 'max']:
            out_value = arch_priority_encoder(gen_lookup, 15, 1, in_histogram)
            test_out.write(convert.bin_to_binstr(out_value) + '\n')
示例#5
0
def test_image():

    with open('image.in.test', 'r') as test_in, \
         open('image.out', 'w') as test_out:

        for line in test_in.readlines():
            in_data = convert.binstr_to_bin(line.replace('\n', ''))
            out_ready, out_data = arch_image(1, in_data)
            if out_ready:
                test_out.write(convert.bin_to_binstr(out_data) + '\n')
def test_histogram_adder():

    with open('histogram_adder_values.in.test', 'r') as test_values_in, \
      open('histogram_adder_enabled.in.test', 'r') as test_enabled_in, \
      open('histogram_adder.out', 'w') as test_out:

        in_values = convert.binstr_to_bin(test_values_in.readline().replace(
            '\n', ''))
        in_enabled = convert.binstr_to_bin(test_enabled_in.readline().replace(
            '\n', ''))
        out_sum = arch_histogram_adder(1, in_values, in_enabled)
        test_out.write(convert.bin_to_binstr(out_sum) + '\n')