90e5ae102f7b442bbdd57ecc6cc98bcd43003c1c
3 #include "MPI_Communication/unpack.h"
4 #include "Util/types.h"
7 #include "Util/utils.h"
12 // Hard-coded packed work
13 unsigned char packedWork
[] =
15 // --> ../data/inputTest.bin
16 46,46,47,100,97,116,97,47,105,110,112,117,116,84,101,115,116,46,98,105,110,
17 // continue with 256 - strlen("../data/inputTest.bin") zeros...
18 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
19 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
20 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
21 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
23 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
24 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
25 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
26 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
27 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
28 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
29 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
30 // --> 5, {ranks}+0,0, 15, 0 on 4-bytes integers little-endian
31 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,
32 15,0,0,0, 0,0,0,0, 2,0,0,0
35 uint32_t nbSeriesInChunk
= 7;
36 Work_t
* work
= unpack_work(packedWork
, nbSeriesInChunk
);
38 LUT_ASSERT(strcmp(work
->inputFileName
, "../data/inputTest.bin") == 0);
39 LUT_ASSERT(work
->nbSeries
== 5);
44 32*16777216 + 2*65536 + 17*256 + 42,
46 51*16777216 + 77*65536 + 0*256 + 10
48 for (uint32_t i
=0; i
< work
->nbSeries
; i
++)
50 LUT_ASSERT(work
->ranks
[i
] == ranks
[i
]);
52 LUT_ASSERT(work
->nbClusters
== 15);
53 LUT_ASSERT(work
->clustOnMedoids
== 0);
54 LUT_ASSERT(work
->p_for_dissims
== 2);
62 // Hard-coded packed result
63 unsigned char packedResult
[] =
65 // 5, {medoids_ID}, {medoids_ranks}
67 11,13,15,0, 11,0,0,0, 42,14,0,17, 7,0,123,0, 10,0,0,51,
68 32,0,5,0, 4,11,0,0, 42,0,0,23, 77,5,35,0, 10,1,1,1
71 Result_t
* result
= unpack_result(packedResult
);
73 LUT_ASSERT(result
->nbClusters
== 5);
74 uint32_t medoids_ID
[] =
78 17*16777216 + 0*65536 + 14*256 + 42,
79 123*65536 + 0*256 + 7,
80 51*16777216 + 0*65536 + 0*256 + 10
82 uint32_t medoids_ranks
[] =
87 35*65536 + 5*256 + 77,
88 1*16777216 + 1*65536 + 1*256 + 10
90 for (uint32_t i
=0; i
<result
->nbClusters
; i
++)
92 LUT_ASSERT(result
->medoids_ID
[i
] == medoids_ID
[i
]);
93 LUT_ASSERT(result
->medoids_ranks
[i
] == medoids_ranks
[i
]);