aboutsummaryrefslogtreecommitdiff
path: root/src/tests/int.cpp
blob: 1601578c160205df1f861346d173720f91531e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "gats/integer.h"

#include <bu/sio.h>
#include <bu/membuf.h>

using namespace Bu;

int main()
{
	MemBuf mb;
	int64_t i = -(100);

	sio << "Before: " << i << sio.nl;
	Gats::Integer::writePackedInt( mb, i );
	mb.write("aaa", 3 );
	mb.setPos( 0 );
	Gats::Integer::readPackedInt( mb, i );
	sio << "After:  " << i << sio.nl;
	char buf[4];
	buf[mb.read( buf, 3 )] = '\0';
	sio << "Extra: \"" << buf << "\"" << sio.nl;

	return 0;
}