Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/cld/encodings/compact_enc_det/compact_enc_det_fuzz_test.cc

Issue 1956183002: CL for perf tryjob on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include <stddef.h>
2 #include <stdlib.h>
3 #include <memory>
4
5 #include "i18n/encodings/compact_enc_det/compact_enc_det.h"
6 #include "i18n/encodings/public/encodings.h"
7 #include "i18n/languages/public/languages.h"
8 #include "testing/base/public/gunit.h"
9
10 namespace {
11
12 class CompactEncDetFuzzTest : public testing::Test {};
13
14 TEST_F(CompactEncDetFuzzTest, TestRandom) {
15 for (size_t i = 0; i < 16384; ++i) {
16 unsigned int seed = i;
17 size_t length = static_cast<size_t>(rand_r(&seed)) % 1024;
18 std::unique_ptr<char[]> text(new char[length]);
19
20 for (size_t j = 0; j < length; ++j) text[j] = rand_r(&seed);
21
22 int bytes_consumed;
23 bool is_reliable;
24
25 CompactEncDet::DetectEncoding(text.get(), length, nullptr, // URL hint
26 nullptr, // HTTP hint
27 nullptr, // Meta hint
28 UNKNOWN_ENCODING,
29 i18n::languages::UNKNOWN_LANGUAGE,
30 CompactEncDet::WEB_CORPUS,
31 false, // Include 7-bit encodings?
32 &bytes_consumed, &is_reliable);
33 }
34 }
35
36 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698