#include <iostream>
#include <j/cppunit/cppunit.hpp>
#include <j/cppunit/assert.hpp>
#include <j/lang/errno.hpp>
using namespace j;
using namespace j::lang;
using namespace j::cppunit;
class ErrnoTest : public TestCase
{
public:
ErrnoTest() {}
~ErrnoTest() {}
void setUp() {}
void tearDown() {}
void testGet()
{
Errno::set(0);
int num = Errno::get();
assertEquals(0, num);
}
void testSet()
{
Errno::set(EINVAL);
int num = Errno::get();
assertEquals(EINVAL, num);
}
void testMessage()
{
String msg = Errno::message(EINVAL);
int len = msg.length();
assertTrue(len > 0);
}
void suite()
{
RUN_TEST("Errno::get", testGet);
RUN_TEST("Errno::set", testSet);
RUN_TEST("Errno::message", testMessage);
}
};