21#include "gdbsupport/ptid.h"
32static_assert (std::is_pod<ptid_t>::value,
"ptid_t is POD");
36static_assert (!std::is_convertible<int, ptid_t>::value,
37 "constructor is explicit");
41static constexpr ptid_t
pid = ptid_t (1);
42static constexpr ptid_t
lwp = ptid_t (1, 2, 0);
43static constexpr ptid_t
tid = ptid_t (1, 0, 2);
44static constexpr ptid_t
both = ptid_t (1, 2, 2);
50static constexpr ptid_t
null = ptid_t::make_null ();
51static constexpr ptid_t
minus_one = ptid_t::make_minus_one ();
55static_assert (
pid.pid () == 1,
"pid's pid is right");
56static_assert (
lwp.pid () == 1,
"lwp's pid is right");
57static_assert (
tid.pid () == 1,
"tid's pid is right");
58static_assert (
both.pid () == 1,
"both's pid is right");
62static_assert (!
pid.lwp_p (),
"pid's lwp_p is right");
63static_assert (
lwp.lwp_p (),
"lwp's lwp_p is right");
64static_assert (!
tid.lwp_p (),
"tid's lwp_p is right");
65static_assert (
both.lwp_p (),
"both's lwp_p is right");
69static_assert (
pid.lwp () == 0,
"pid's lwp is right");
70static_assert (
lwp.lwp () == 2,
"lwp's lwp is right");
71static_assert (
tid.lwp () == 0,
"tid's lwp is right");
72static_assert (
both.lwp () == 2,
"both's lwp is right");
76static_assert (!
pid.tid_p (),
"pid's tid_p is right");
77static_assert (!
lwp.tid_p (),
"lwp's tid_p is right");
78static_assert (
tid.tid_p (),
"tid's tid_p is right");
79static_assert (
both.tid_p (),
"both's tid_p is right");
83static_assert (
pid.tid () == 0,
"pid's tid is right");
84static_assert (
lwp.tid () == 0,
"lwp's tid is right");
85static_assert (
tid.tid () == 2,
"tid's tid is right");
86static_assert (
both.tid () == 2,
"both's tid is right");
90static_assert (
pid.is_pid (),
"pid is a pid");
91static_assert (!
lwp.is_pid (),
"lwp isn't a pid");
92static_assert (!
tid.is_pid (),
"tid isn't a pid");
93static_assert (!
both.is_pid (),
"both isn't a pid");
94static_assert (!
null.is_pid (),
"null ptid isn't a pid");
95static_assert (!
minus_one.is_pid (),
"minus one ptid isn't a pid");
99static_assert (
pid == ptid_t (1, 0, 0),
"pid operator== is right");
100static_assert (
lwp == ptid_t (1, 2, 0),
"lwp operator== is right");
101static_assert (
tid == ptid_t (1, 0, 2),
"tid operator== is right");
102static_assert (
both == ptid_t (1, 2, 2),
"both operator== is right");
106static_assert (
pid != ptid_t (2, 0, 0),
"pid isn't equal to a different pid");
107static_assert (
pid !=
lwp,
"pid isn't equal to one of its thread");
108static_assert (
lwp !=
tid,
"lwp isn't equal to tid");
109static_assert (
both !=
lwp,
"both isn't equal to lwp");
110static_assert (
both !=
tid,
"both isn't equal to tid");
114static_assert (
pid.matches (
minus_one),
"pid matches minus one");
115static_assert (
lwp.matches (
minus_one),
"lwp matches minus one");
116static_assert (
tid.matches (
minus_one),
"tid matches minus one");
117static_assert (
both.matches (
minus_one),
"both matches minus one");
121static_assert (
pid.matches (
pid),
"pid matches pid");
122static_assert (
lwp.matches (
pid),
"lwp matches pid");
123static_assert (
tid.matches (
pid),
"tid matches pid");
124static_assert (
both.matches (
pid),
"both matches pid");
125static_assert (!ptid_t (2, 0, 0).matches (
pid),
"other pid doesn't match pid");
126static_assert (!ptid_t (2, 2, 0).matches (
pid),
"other lwp doesn't match pid");
127static_assert (!ptid_t (2, 0, 2).matches (
pid),
"other tid doesn't match pid");
128static_assert (!ptid_t (2, 2, 2).matches (
pid),
"other both doesn't match pid");
132static_assert (!
pid.matches (
lwp),
"pid doesn't match lwp");
133static_assert (
lwp.matches (
lwp),
"lwp matches lwp");
134static_assert (!
tid.matches (
lwp),
"tid doesn't match lwp");
135static_assert (!
both.matches (
lwp),
"both doesn't match lwp");
136static_assert (!ptid_t (2, 2, 0).matches (
lwp),
"other lwp doesn't match lwp");
138static_assert (!
pid.matches (
tid),
"pid doesn't match tid");
139static_assert (!
lwp.matches (
tid),
"lwp doesn't match tid");
140static_assert (
tid.matches (
tid),
"tid matches tid");
141static_assert (!
both.matches (
tid),
"both doesn't match tid");
142static_assert (!ptid_t (2, 0, 2).matches (
tid),
"other tid doesn't match tid");
144static_assert (!
pid.matches (
both),
"pid doesn't match both");
145static_assert (!
lwp.matches (
both),
"lwp doesn't match both");
146static_assert (!
tid.matches (
both),
"tid doesn't match both");
147static_assert (
both.matches (
both),
"both matches both");
148static_assert (!ptid_t (2, 2, 2).matches (
both),
149 "other both doesn't match both");
static constexpr ptid_t both
static constexpr ptid_t minus_one
static constexpr ptid_t tid
static constexpr ptid_t pid
static constexpr ptid_t lwp
static constexpr ptid_t null