From 306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 15 May 2010 07:44:10 +0000 Subject: mkunit.sh was a little dumb, it didn't handle a number of things correctly. I've written a new program that basically does the same thing, only it's much more clever, and does many more of the translations and conversions better, including the #line directives. Also, I dropped nids, we don't need it anymore. But now I'm ready to write some serious tests for myriad. --- src/unit/substream.unit | 74 ++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/unit/substream.unit') diff --git a/src/unit/substream.unit b/src/unit/substream.unit index 802ad4c..49817b0 100644 --- a/src/unit/substream.unit +++ b/src/unit/substream.unit @@ -9,44 +9,44 @@ #include "bu/membuf.h" #include "bu/substream.h" -{=Init} - -{%testRead01} +suite SubStream { - Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); - mb.seek( 4 ); - Bu::SubStream ss( mb, 10 ); - unitTest( ss.readLine() == "efghijklmn" ); -} + test testRead01 + { + Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); + mb.seek( 4 ); + Bu::SubStream ss( mb, 10 ); + unitTest( ss.readLine() == "efghijklmn" ); + } -{%testRead02} -{ - Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); - mb.seek( 4 ); - Bu::SubStream ss( mb, 10 ); - char buf[8]; - size_t iRead = ss.read( buf, 8 ); - unitTest( iRead == 8 ); - unitTest( strncmp( buf, "efghijkl", 8 ) == 0 ); - unitTest( !ss.isEos() ); - iRead = ss.read( buf, 8 ); - unitTest( iRead == 2 ); - unitTest( strncmp( buf, "mn", 2 ) == 0 ); - unitTest( ss.isEos() ); -} + test testRead02 + { + Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); + mb.seek( 4 ); + Bu::SubStream ss( mb, 10 ); + char buf[8]; + size_t iRead = ss.read( buf, 8 ); + unitTest( iRead == 8 ); + unitTest( strncmp( buf, "efghijkl", 8 ) == 0 ); + unitTest( !ss.isEos() ); + iRead = ss.read( buf, 8 ); + unitTest( iRead == 2 ); + unitTest( strncmp( buf, "mn", 2 ) == 0 ); + unitTest( ss.isEos() ); + } -{%testRead03} -{ - Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); - mb.seek( 20 ); - Bu::SubStream ss( mb, 10 ); - char buf[8]; - size_t iRead = ss.read( buf, 8 ); - unitTest( iRead == 6 ); - unitTest( strncmp( buf, "uvwxyz", 6 ) == 0 ); - unitTest( ss.isEos() ); - iRead = ss.read( buf, 8 ); - unitTest( iRead == 0 ); - unitTest( ss.isEos() ); + test testRead03 + { + Bu::MemBuf mb("abcdefghijklmnopqrstuvwxyz"); + mb.seek( 20 ); + Bu::SubStream ss( mb, 10 ); + char buf[8]; + size_t iRead = ss.read( buf, 8 ); + unitTest( iRead == 6 ); + unitTest( strncmp( buf, "uvwxyz", 6 ) == 0 ); + unitTest( ss.isEos() ); + iRead = ss.read( buf, 8 ); + unitTest( iRead == 0 ); + unitTest( ss.isEos() ); + } } - -- cgit v1.2.3