OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iostream> | 8 #include <iostream> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 --g_depth; | 403 --g_depth; |
404 return true; | 404 return true; |
405 } | 405 } |
406 }; | 406 }; |
407 | 407 |
408 | 408 |
409 template <class A, class B> | 409 template <class A, class B> |
410 struct GenerateTraits<std::map<A, B> > { | 410 struct GenerateTraits<std::map<A, B> > { |
411 static bool Generate(std::map<A, B>* p, Generator* generator) { | 411 static bool Generate(std::map<A, B>* p, Generator* generator) { |
412 static int g_depth = 0; | 412 static int g_depth = 0; |
413 size_t count = ++g_depth > 3 ? 0 : RandInRange(20); | 413 size_t count = ++g_depth > 3 ? 0 : RandInRange(10); |
414 std::pair<A, B> place_holder; | 414 std::pair<A, B> place_holder; |
415 for (size_t i = 0; i < count; ++i) { | 415 for (size_t i = 0; i < count; ++i) { |
416 if (!GenerateParam(&place_holder, generator)) { | 416 if (!GenerateParam(&place_holder, generator)) { |
417 --g_depth; | 417 --g_depth; |
418 return false; | 418 return false; |
419 } | 419 } |
420 p->insert(place_holder); | 420 p->insert(place_holder); |
421 } | 421 } |
422 --g_depth; | 422 --g_depth; |
423 return true; | 423 return true; |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 return EXIT_FAILURE; | 1414 return EXIT_FAILURE; |
1415 | 1415 |
1416 return EXIT_SUCCESS; | 1416 return EXIT_SUCCESS; |
1417 } | 1417 } |
1418 | 1418 |
1419 } // namespace ipc_fuzzer | 1419 } // namespace ipc_fuzzer |
1420 | 1420 |
1421 int main(int argc, char** argv) { | 1421 int main(int argc, char** argv) { |
1422 return ipc_fuzzer::GenerateMain(argc, argv); | 1422 return ipc_fuzzer::GenerateMain(argc, argv); |
1423 } | 1423 } |
OLD | NEW |