Skip to content

Commit 457970d

Browse files
committed
[libc++][NFC] Format std::num_put tests
1 parent bf02dfc commit 457970d

File tree

13 files changed

+45280
-45353
lines changed

13 files changed

+45280
-45353
lines changed

libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/ctor.pass.cpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,33 @@
1919

2020
typedef std::num_put<char, char*> F;
2121

22-
class my_facet
23-
: public F
24-
{
22+
class my_facet : public F {
2523
public:
26-
static int count;
24+
static int count;
2725

28-
explicit my_facet(std::size_t refs = 0)
29-
: F(refs) {++count;}
26+
explicit my_facet(std::size_t refs = 0) : F(refs) { ++count; }
3027

31-
~my_facet() {--count;}
28+
~my_facet() { --count; }
3229
};
3330

3431
int my_facet::count = 0;
3532

36-
int main(int, char**)
37-
{
33+
int main(int, char**) {
34+
{
35+
std::locale l(std::locale::classic(), new my_facet);
36+
assert(my_facet::count == 1);
37+
}
38+
assert(my_facet::count == 0);
39+
{
40+
my_facet f(1);
41+
assert(my_facet::count == 1);
3842
{
39-
std::locale l(std::locale::classic(), new my_facet);
40-
assert(my_facet::count == 1);
43+
std::locale l(std::locale::classic(), &f);
44+
assert(my_facet::count == 1);
4145
}
42-
assert(my_facet::count == 0);
43-
{
44-
my_facet f(1);
45-
assert(my_facet::count == 1);
46-
{
47-
std::locale l(std::locale::classic(), &f);
48-
assert(my_facet::count == 1);
49-
}
50-
assert(my_facet::count == 1);
51-
}
52-
assert(my_facet::count == 0);
46+
assert(my_facet::count == 1);
47+
}
48+
assert(my_facet::count == 0);
5349

5450
return 0;
5551
}

libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_bool.pass.cpp

Lines changed: 56 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,82 +21,76 @@
2121

2222
typedef std::num_put<char, cpp17_output_iterator<char*> > F;
2323

24-
class my_facet
25-
: public F
26-
{
24+
class my_facet : public F {
2725
public:
28-
explicit my_facet(std::size_t refs = 0)
29-
: F(refs) {}
26+
explicit my_facet(std::size_t refs = 0) : F(refs) {}
3027
};
3128

32-
class my_numpunct
33-
: public std::numpunct<char>
34-
{
29+
class my_numpunct : public std::numpunct<char> {
3530
public:
36-
my_numpunct() : std::numpunct<char>() {}
31+
my_numpunct() : std::numpunct<char>() {}
3732

3833
protected:
39-
virtual string_type do_truename() const {return "yes";}
40-
virtual string_type do_falsename() const {return "no";}
34+
virtual string_type do_truename() const { return "yes"; }
35+
virtual string_type do_falsename() const { return "no"; }
4136
};
4237

43-
int main(int, char**)
44-
{
45-
const my_facet f(1);
38+
int main(int, char**) {
39+
const my_facet f(1);
40+
{
41+
std::ios ios(0);
4642
{
47-
std::ios ios(0);
48-
{
49-
bool v = false;
50-
char str[50];
51-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
52-
std::string ex(str, base(iter));
53-
assert(ex == "0");
54-
}
55-
{
56-
bool v = true;
57-
char str[50];
58-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
59-
std::string ex(str, base(iter));
60-
assert(ex == "1");
61-
}
43+
bool v = false;
44+
char str[50];
45+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
46+
std::string ex(str, base(iter));
47+
assert(ex == "0");
6248
}
6349
{
64-
std::ios ios(0);
65-
std::boolalpha(ios);
66-
{
67-
bool v = false;
68-
char str[50];
69-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
70-
std::string ex(str, base(iter));
71-
assert(ex == "false");
72-
}
73-
{
74-
bool v = true;
75-
char str[50];
76-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
77-
std::string ex(str, base(iter));
78-
assert(ex == "true");
79-
}
50+
bool v = true;
51+
char str[50];
52+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
53+
std::string ex(str, base(iter));
54+
assert(ex == "1");
8055
}
56+
}
57+
{
58+
std::ios ios(0);
59+
std::boolalpha(ios);
8160
{
82-
std::ios ios(0);
83-
std::boolalpha(ios);
84-
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
85-
{
86-
bool v = false;
87-
char str[50];
88-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
89-
std::string ex(str, base(iter));
90-
assert(ex == "no");
91-
}
92-
{
93-
bool v = true;
94-
char str[50];
95-
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
96-
std::string ex(str, base(iter));
97-
assert(ex == "yes");
98-
}
61+
bool v = false;
62+
char str[50];
63+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
64+
std::string ex(str, base(iter));
65+
assert(ex == "false");
9966
}
67+
{
68+
bool v = true;
69+
char str[50];
70+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
71+
std::string ex(str, base(iter));
72+
assert(ex == "true");
73+
}
74+
}
75+
{
76+
std::ios ios(0);
77+
std::boolalpha(ios);
78+
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
79+
{
80+
bool v = false;
81+
char str[50];
82+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
83+
std::string ex(str, base(iter));
84+
assert(ex == "no");
85+
}
86+
{
87+
bool v = true;
88+
char str[50];
89+
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
90+
std::string ex(str, base(iter));
91+
assert(ex == "yes");
92+
}
93+
}
10094

10195
return 0;
10296
}

0 commit comments

Comments
 (0)