safe
[ghsmtp.git] / MessageStore-test.cpp
blob222ca0dd14d73f85da9beca3e3cfb4a8d56e4a8d
1 #include "MessageStore.hpp"
3 #include <iostream>
5 #include <cstdlib>
7 int main(int argc, char* argv[])
9 char env[] = "MAILDIR=/tmp/Maildir";
10 PCHECK(putenv(env) == 0);
12 MessageStore msg;
13 msg.open("example.com", 4096, "");
15 std::string ms{"foo bar baz"};
16 msg.write(ms.data(), ms.size());
17 msg.deliver();
19 MessageStore msg2;
20 msg2.open("example.com", 4096, ".Junk");
22 CHECK(msg.id() != msg2.id());
24 std::stringstream msg_str, msg2_str;
26 msg_str << msg.id();
27 msg2_str << msg2.id();
29 CHECK_NE(msg_str.str(), msg2_str.str());
31 msg2.trash();
33 std::cout << "sizeof(MessageStore) == " << sizeof(MessageStore) << '\n';