Skip to content

Unit Tests Data Format

9prady9 edited this page Nov 17, 2014 · 1 revision

This page describes the format in which test data need to be submitted to the arrayfire_data repository. Of course, this format is only required if you plan to use the utility functions in the file [testHelpers.hpp] (https://github.com/arrayfire/arrayfire/blob/devel/test/testHelpers.hpp) to read the test data. If you choose to use the available helper functions, please follow the format explained here. All test data files should be placed under the folder named after the function for which test data is created. For example, if the test data is for erode/dilate function, place the files under the folder morph.

An complete example of the test data layout is provided below. The data is pretty formatted below for readability, but while generating the data one can provide just a list of numbers.

1
10 10 1 1
3
42
42
24

 0  1  2  3  4  5  6  7  8  9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59
60 61 62 63 64 65 66 67 68 69
70 71 72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87 88 89
90 91 92 93 94 95 96 97 98 99

 1  2  3  4  5  6
11 12 13 14 15 16
21 22 23 24 25 26
31 32 33 34 35 36
41 42 43 44 45 46
51 52 53 54 55 56
61 62 63 64 65 66

43 44 45 46 47 48 49
53 54 55 56 57 58 59
63 64 65 66 67 68 69
73 74 75 76 77 78 79
83 84 85 86 87 88 89
93 94 95 96 97 98 99

35 36 37 38
45 46 47 48
55 56 57 58
65 66 67 68
75 76 77 78
85 86 87 88

Another format(given below) is available for functions that need to test using images. To read test data in the below format, one would have to use this function.

number of inputs
4-dimensional size of input 0
...
4-dimensional size of input n

number of results
total elements of results 0
...
total elements of results n

ith input image path relative to test data directory
...
ith output image path relative to test data directory

test data for output 0
...
test data for output n

A couple of examples are given below.

Grayscale Image Color Image
1
1024 1024 1 1
1
1048576

robot.jpg robot_dilate.jpg

1
512 512 3 1
1
786432

lena.jpg lena_erode.jpg