Home | History | Annotate | Download | only in libpdx

Lines Matching defs:status

1 #include <pdx/status.h>
6 using android::pdx::Status;
8 TEST(Status, DefaultInit) {
9 Status<int> status;
10 EXPECT_FALSE(status.ok());
11 EXPECT_TRUE(status.empty());
12 EXPECT_EQ(0, status.get());
13 EXPECT_EQ(0, status.error());
16 TEST(Status, InitalizeSuccess) {
17 Status<int> status_int{0};
21 status_int = Status<int>(3);
25 status_int = Status<int>(-3);
30 Status<std::string> status_str{"foo"};
36 TEST(Status, InitalizeError) {
37 Status<int> status_int = ErrorStatus(12);
43 Status<std::string> status_str = ErrorStatus(EIO);
49 TEST(Status, ErrorMessage) {
50 Status<int> status = ErrorStatus(EIO);
51 EXPECT_EQ(status.GetErrorMessage(), strerror(EIO));
53 status = ErrorStatus(EINVAL);
54 EXPECT_EQ(status.GetErrorMessage(), strerror(EINVAL));
57 TEST(Status, Copy) {
58 Status<int> status1;
59 Status<int> status2;
61 status1 = Status<int>{12};
83 TEST(Status, Move) {
84 Status<std::unique_ptr<int>> status1;
85 Status<std::unique_ptr<int>> status2;
87 status1 = Status<std::unique_ptr<int>>{std::unique_ptr<int>{new int{11}}};
88 status2 = Status<std::unique_ptr<int>>{std::unique_ptr<int>{new int{12}}};
96 Status<std::unique_ptr<int>> status3 = std::move(status2);
116 TEST(Status, Take) {
117 Status<std::unique_ptr<int>> status{std::unique_ptr<int>{new int{123}}};
118 EXPECT_FALSE(status.empty());
119 EXPECT_NE(nullptr, status.get());
121 auto data = status.take();
122 EXPECT_TRUE(status.empty());
123 EXPECT_EQ(nullptr, status.get());