Function to the test hamming distance.
75 {
76 assert(bit_manipulation::hamming_distance::hamming_distance(11, 2) == 2);
77 assert(bit_manipulation::hamming_distance::hamming_distance(2, 0) == 1);
78 assert(bit_manipulation::hamming_distance::hamming_distance(11, 0) == 3);
79
80 assert(bit_manipulation::hamming_distance::hamming_distance("1101",
81 "1111") == 1);
82 assert(bit_manipulation::hamming_distance::hamming_distance("1111",
83 "1111") == 0);
84 assert(bit_manipulation::hamming_distance::hamming_distance("0000",
85 "1111") == 4);
86
87 assert(bit_manipulation::hamming_distance::hamming_distance("alpha",
88 "alphb") == 1);
89 assert(bit_manipulation::hamming_distance::hamming_distance("abcd",
90 "abcd") == 0);
91 assert(bit_manipulation::hamming_distance::hamming_distance("dcba",
92 "abcd") == 4);
93}