1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "ugc/ugc_tests/utils.hpp"
namespace
{
ugc::Time FromDaysAgo(ugc::Time time, uint32_t days)
{
return time - std::chrono::hours(days * 24);
}
} // namespace
namespace ugc
{
UGC MakeTestUGC1(Time now)
{
Ratings records;
records.emplace_back("food" /* key */, 4.0 /* value */);
records.emplace_back("service" /* key */, 5.0 /* value */);
records.emplace_back("music" /* key */, 5.0 /* value */);
Reviews reviews;
reviews.emplace_back(20 /* id */, Text("Damn good coffee", StringUtf8Multilang::kEnglishCode),
Author(UID(987654321 /* hi */, 123456789 /* lo */), "Cole"),
5.0 /* rating */, FromDaysAgo(now, 10));
reviews.emplace_back(
67812 /* id */, Text("Clean place, reasonably priced", StringUtf8Multilang::kDefaultCode),
Author(UID(0 /* hi */, 315 /* lo */), "Cooper"), 5.0 /* rating */, FromDaysAgo(now, 1));
return UGC(records, reviews, 4.5 /* rating */);
}
UGC MakeTestUGC2(Time now)
{
Ratings records;
records.emplace_back("food" /* key */, 5.0 /* value */);
records.emplace_back("service" /* key */, 5.0 /* value */);
records.emplace_back("music" /* key */, 5.0 /* value */);
vector<Review> reviews;
reviews.emplace_back(
119 /* id */, Text("This pie's so good it is a crime", StringUtf8Multilang::kDefaultCode),
Author(UID(0 /* hi */, 315 /* lo */), "Cooper"), 5.0 /* rating */, FromDaysAgo(now, 1));
return UGC(records, reviews, 5.0 /* rating */);
}
UGCUpdate MakeTestUGCUpdate(Time now)
{
Ratings records;
records.emplace_back("food" /* key */, 4.0 /* value */);
records.emplace_back("service" /* key */, 5.0 /* value */);
records.emplace_back("music" /* key */, 5.0 /* value */);
Text text{"It's aways nice to visit this place", StringUtf8Multilang::kEnglishCode};
Time time{FromDaysAgo(now, 1)};
return UGCUpdate(records, text, time);
}
}
|