125fd47d5e42d7cd5200f6197797e05a1d580dd9
3 #include "MPI_Communication/pack.h"
4 #include "Util/types.h"
6 #include "Util/utils.h"
11 Work_t
* work
= (Work_t
*)malloc(sizeof(Work_t
));
12 work
->inputFileName
= "../data/inputTest.bin";
18 32*16777216 + 2*65536 + 17*256 + 42,
20 51*16777216 + 77*65536 + 0*256 + 10
23 work
->nbClusters
= 15;
24 work
->clustOnMedoids
= 0;
25 work
->p_for_dissims
= 1;
27 // Hard-coded expected packed work
28 unsigned char expectedPackedWork
[] =
30 // --> ../data/inputTest.bin
31 46,46,47,100,97,116,97,47,105,110,112,117,116,84,101,115,116,46,98,105,110,
32 // continue with 256 - strlen("../data/inputTest.bin") zeros...
33 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
34 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
35 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
36 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
37 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
38 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
39 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
40 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
41 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
42 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
43 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
44 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
45 // --> 5, {ranks}+0,0, 15, 0 on 4-bytes integers little-endian
46 5,0,0,0, 0,0,0,0, 11,3,12,0, 42,17,2,32, 123,0,0,0, 10,0,77,51, 0,0,0,0, 0,0,0,0,
47 15,0,0,0, 0,0,0,0, 1,0,0,0
50 uint32_t nbSeriesInChunk
= 7;
51 uint32_t work_message_length
= get_packedWork_length(nbSeriesInChunk
);
52 unsigned char packedWork
[work_message_length
];
53 pack_work(work
, nbSeriesInChunk
, packedWork
);
55 for (uint32_t i
=0; i
<work_message_length
; i
++)
57 LUT_ASSERT(packedWork
[i
] == expectedPackedWork
[i
]);
66 Result_t
* result
= (Result_t
*)malloc(sizeof(Result_t
));
67 uint32_t nbClusters
= result
->nbClusters
= 5;
68 uint32_t medoids_ID
[] =
72 17*16777216 + 0*65536 + 14*256 + 42,
73 123*65536 + 0*256 + 7,
74 51*16777216 + 0*65536 + 0*256 + 10
76 result
->medoids_ID
= medoids_ID
;
77 uint32_t medoids_ranks
[] =
82 35*65536 + 5*256 + 77,
83 1*16777216 + 1*65536 + 1*256 + 10
85 result
->medoids_ranks
= medoids_ranks
;
87 // Hard-coded expected result
88 unsigned char expectedPackedResult
[] =
90 // 5, {medoids_ID}, {medoids_ranks}
92 11,13,15,0, 11,0,0,0, 42,14,0,17, 7,0,123,0, 10,0,0,51,
93 32,0,5,0, 4,11,0,0, 42,0,0,23, 77,5,35,0, 10,1,1,1
96 uint32_t result_message_length
= get_packedResult_length(nbClusters
);
97 unsigned char packedResult
[result_message_length
];
98 pack_result(result
, packedResult
);
100 for (uint32_t i
=0; i
<result_message_length
; i
++)
102 LUT_ASSERT(packedResult
[i
] == expectedPackedResult
[i
]);