I suggest that you rename testit to distinct_merge or unique_merge or something like that. Before you implement unique_merge, implement two other functions, making sure you test them to be sure they work individually: remove_duplicates and merge.

remove_duplicates takes a pointer to a sorted array and the size of the array, then removes the duplicates in-place, returning the final number of elements in use. This in-place removal can be done by overwriting the duplicates by copying the unique values in their place, then you just don't care about the remaining elements beyond the number you return.

merge would take the same parameters as unique_merge, except that it assumes that the arrays are already sorted with the duplicates removed.

You then implement unique_merge using qsort, remove_duplicates, and merge.