libasio/tests/basics/driver.cxx
2023-07-13 09:29:01 +02:00

35 lines
478 B
C++

#include <sstream>
#include <stdexcept>
#include <asio/asio.hxx>
#undef NDEBUG
#include <cassert>
int main ()
{
using namespace std;
using namespace asio;
// Basics.
//
{
ostringstream o;
say_hello (o, "World");
assert (o.str () == "Hello, World!\n");
}
// Empty name.
//
try
{
ostringstream o;
say_hello (o, "");
assert (false);
}
catch (const invalid_argument& e)
{
assert (e.what () == string ("empty name"));
}
}