mosesdecoder/util/sized_iterator_test.cc
Kenneth Heafield 14e02978fc KenLM 5cc905bc2d214efa7de2db56a9a672b749a95591
Avoid unspecified behavior of mmap when a file is resized reported by Christian Hardmeier
Fixes for Mavericks and a workaround for Boost's broken semaphore
Clean clang compile (of kenlm)

Merged some of 744376b3fb but also undid some of it because it was just masking a fundaemntal problem with pread rather than working around windows limitations
2014-01-27 16:51:35 -08:00

17 lines
376 B
C++

#include "util/sized_iterator.hh"
#define BOOST_TEST_MODULE SizedIteratorTest
#include <boost/test/unit_test.hpp>
namespace util { namespace {
BOOST_AUTO_TEST_CASE(swap_works) {
char str[2] = { 0, 1 };
SizedProxy first(str, 1), second(str + 1, 1);
swap(first, second);
BOOST_CHECK_EQUAL(1, str[0]);
BOOST_CHECK_EQUAL(0, str[1]);
}
}} // namespace anonymous util