[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/AmitSna/StringNAndBlockStream/master/StringNTest.cpp [Back]  [Original]

/* BlockStreamTest.cpp
2015-11-09 - 2018-07-01
Esp. Ing. Jos Mara Sola
Profesor
UTN FRBA */

#include "StringN.h"
#include 

int main(){
	// Simple test
	std::string s{"Hello, World!"}; // Standard unbounded string s.
	String a = PackString(s);    // Put s into bounded string a.
	auto t{UnpackString(a)};        // Get the string from a.
	assert("Hello" == t);           // Check.
	
	// Test against non-pod (standard layout, trivial) implementation.
	union Color{
		String s; // Try n' do this with a std::string.
		int i;
	};
	Color c{PackString("Red")};
	assert("Red" == UnpackString(c.s));
	c.s = PackString("Blue");
	assert("Blu" == UnpackString(c.s));
}

Web Proxy Viewer  |  New URL  |  Original Page