27 for (
int i = 0;
i < 100;
i++) {
28 std::vector<int> vec, vec2;
30 for (
int i = 0;
i < len;
i++)
31 vec.push_back(
Rand() % 10);
33 std::sort(vec2.begin(), vec2.end());
39 for (
int i = 0;
i < 100;
i++) {
40 std::vector<int> vec, vec2;
42 for (
int i = 0;
i < len;
i++)
43 vec.push_back(
Rand() % 10);
47 for (
size_t i = 0;
i+1 < (
size_t)len;
i++)
48 if (vec[
i] >= vec[
i+1]) ok =
true;
51 for (
size_t i = 0;
i+1 < (
size_t)len;
i++)
59 for (
int i = 0;
i < 100;
i++) {
64 for (
int i = 0;
i < len;
i++) {
65 cur += 1 + (
Rand() % 100);
68 std::vector<int> vec2;
69 for (
int i = 0;
i < len;
i++) {
71 for (
int j = 0;
j <
count;
j++) vec2.push_back(vec[
i]);
80 for (
int i = 0;
i < 100;
i++) {
84 for (
int i = 0;
i < len;
i++) {
87 for (
size_t j = 0;
j < vec.size();
j++)
if (vec[
j] == n) ok =
false;
88 if (ok) vec.push_back(n);
91 std::vector<int> vec2(vec);
95 for (
int i = 0;
i < len2;
i++)
96 vec2.push_back(vec[
Rand()%vec.size()]);
98 std::sort(vec.begin(), vec.end());
104 for (
int p = 0; p < 100; p++) {
106 int sz =
Rand() % 20;
107 for (
int i = 0;
i < sz;
i++) st.insert(
Rand() % 10);
117 for (
int p = 0; p < 100; p++) {
118 std::map<int, int> mp;
119 int sz =
Rand() % 20;
120 for (
int i = 0;
i < sz;
i++) mp[
Rand() % 10] =
Rand() % 20;
121 std::vector<std::pair<int, int> > v;
124 for (
size_t i = 0;
i < v.size();
i++)
131 for (
int p = 0; p < 100; p++) {
132 std::map<int, int> mp;
133 int sz =
Rand() % 20;
134 for (
int i = 0;
i < sz;
i++) mp[
Rand() % 10] =
Rand() % 20;
143 for (
int p = 0; p < 100; p++) {
144 std::map<int, int> mp;
145 int sz =
Rand() % 20;
146 for (
int i = 0;
i < sz;
i++) mp[
Rand() % 10] =
Rand() % 20;
151 for (std::map<int, int>::iterator iter = mp.begin(); iter != mp.end();
159 for (
int p = 0; p < 100; p++) {
160 std::map<int, int> mp;
161 int sz =
Rand() % 20;
162 for (
int i = 0;
i < sz;
i++) mp[
Rand() % 10] =
Rand() % 20;
175 for (
int p = 0; p < 100; p++) {
176 std::map<int, int> mp;
177 int sz =
Rand() % 20;
178 for (
int i = 0;
i < sz;
i++) mp[
Rand() % 10] =
Rand() % 20;
191 for (
int p = 0; p < 100; p++) {
192 std::vector<char*> vec;
194 bool is_null =
false;
195 for (
int i = 0;
i < sz;
i++) {
196 vec.push_back(reinterpret_cast<char*>(static_cast<intptr_t>(
Rand() % 2)));
197 if (vec.back() == NULL)
205 for (
int p = 0; p < 100; p++) {
206 std::vector<int> vec;
208 for (
int i = 0;
i < sz;
i++)
209 vec.push_back(
Rand() % 4);
210 std::vector<int> vec2(vec), vec3(vec);
215 for (
size_t i = 0;
i < vec.size();
i++)
221 for (
int p = 0; p < 100; p++) {
222 std::vector<std::pair<int32, int16> > v;
223 std::map<int32, int16> m;
224 int sz =
Rand() % 10;
225 for (
size_t i = 0;
i < sz;
i++) {
227 int16 val = (
Rand() % 5) - 2;
228 v.push_back(std::make_pair(key, val));
229 if (m.count(key) == 0) m[key] = val;
235 for (
size_t i = 0;
i < v.size();
i++) {
240 for (std::map<int32, int16>::const_iterator iter = m.begin();
241 iter != m.end(); ++iter) {
242 if (iter->second != 0) {
244 for (i = 0; i < v.size(); i++)
245 if (v[i].first == iter->first)
break;
256 using namespace kaldi;
271 std::cout <<
"Test OK\n";
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CopySetToVector(const std::set< T > &s, std::vector< T > *v)
Copies the elements of a set to a vector.
void CopyMapValuesToSet(const std::map< A, B > &m, std::set< B > *s)
Copies the values in a map to a set.
void CopyMapKeysToVector(const std::map< A, B > &m, std::vector< A > *v)
Copies the keys in a map to a vector.
void Uniq(std::vector< T > *vec)
Removes duplicate elements from a sorted list.
static void TestIsSorted()
bool ContainsNullPointers(const std::vector< A *> &v)
Returns true if the vector of pointers contains NULL pointers.
void CopyVectorToSet(const std::vector< A > &v, std::set< A > *s)
Copies the contents of a vector to a set.
void SortAndUniq(std::vector< T > *vec)
Sorts and uniq's (removes duplicates) from a vector.
void TestCopyMapKeysToSet()
static void TestIsSortedAndUniq()
void TestCopyMapToVector()
void CopyMapKeysToSet(const std::map< A, B > &m, std::set< A > *s)
Copies the keys in a map to a set.
void TestCopyMapValuesToVector()
void TestCopyMapValuesToSet()
void CopyMapValuesToVector(const std::map< A, B > &m, std::vector< B > *v)
Copies the values in a map to a vector.
void ReverseVector(std::vector< T > *vec)
Reverses the contents of a vector.
int Rand(struct RandomState *state)
void TestMergePairVectorSumming()
bool IsSorted(const std::vector< T > &vec)
Returns true if the vector is sorted.
#define KALDI_ASSERT(cond)
void MergePairVectorSumming(std::vector< std::pair< I, F > > *vec)
For a vector of pair<I, F> where I is an integer and F a floating-point or integer type...
void TestCopySetToVector()
void TestContainsNullPointers()
bool IsSortedAndUniq(const std::vector< T > &vec)
Returns true if the vector is sorted and contains each element only once.
void CopyMapToVector(const std::map< A, B > &m, std::vector< std::pair< A, B > > *v)
Copies the (key, value) pairs in a map to a vector of pairs.
static void TestSortAndUniq()
void TestCopyMapKeysToVector()