1234567891011121314151617181920212223242526272829303132 |
- //
- // Created by robin on 5/10/16.
- //
-
- #include <gtest/gtest.h>
- #include "DBO/Result.h"
- #include "Common.h"
-
- TEST(Result, ok)
- {
- Common::testStream(ResultInt::ok(42), "Success: 42");
- Common::testStream(ResultInt::ok(0), "Success: 0");
- Common::testStream(ResultBool::ok(true), "Success: 1");
- Common::testStream(ResultBool::ok(false), "Success: 0");
- Common::testStream(ResultDouble::ok(0.42), "Success: 0.42");
- Common::testStream(ResultDouble::ok(-0.42), "Success: -0.42");
- }
-
- TEST(Result, error)
- {
- Common::testStream(ResultInt::error("My error label"), "Error: My error label");
- Common::testStream(ResultInt::error(""), "Error: Unknown error");
- }
-
- TEST(Result, strerror)
- {
- errno = 0;
- Common::testStream(ResultInt::strerror(), "Error: Success");
- errno = EACCES;
- Common::testStream(ResultInt::strerror(), "Error: Permission denied");
- errno = 0;
- }
|