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
|
#include <assert.h>
#include "fcitx-utils/utils.h"
#include "fcitx/fcitx.h"
int main()
{
UT_array array;
utarray_init(&array, &ut_int_icd);
int test[] = {3, 1, 2};
int test2[] = {1, 2, 3};
FCITX_UNUSED(test);
FCITX_UNUSED(test2);
int i;
i = 1;
utarray_push_back(&array, &i);
i = 2;
utarray_push_back(&array, &i);
i = 3;
utarray_push_back(&array, &i);
utarray_move(&array, 2, 0);
{
utarray_foreach(p, &array, int) {
assert(*p == test[utarray_eltidx(&array, p)]);
}
}
utarray_move(&array, 0, 2);
{
utarray_foreach(p, &array, int) {
assert(*p == test2[utarray_eltidx(&array, p)]);
}
}
utarray_done(&array);
return 0;
}
|