test.cpp 1.94 KB
Newer Older
Swann Perarnau's avatar
Swann Perarnau committed
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#include "utils.hpp"
#include <iostream>
#include <string>
#include <stdio.h>
#include <cassert>
using namespace std;

void test_str_stuff(string input, string delim)
{
#if 0
	string copy = input;
	string out;


	printf("\n");

	string token;
	str_extract_before(copy, delim, token, false);
	printf("[str_extract_before(copy, delim, token, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	str_extract_before(copy, delim, token, true);
	printf("[str_extract_before(copy, delim, token, true)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	str_extract_after(copy, delim, token, false);
	printf("[str_extract_after(copy, delim, token, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	str_extract_after(copy, delim, token, true);
	printf("[str_extract_after(copy, delim, token, true)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());


	copy = input;
	str_chop_before(copy, delim, token, false, false);
	printf("[str_chop_before(copy, delim, token, false, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	copy = input;
	str_chop_before(copy, delim, token, true, false);
	printf("[str_chop_before(copy, delim, token, true, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	copy = input;
	str_chop_after(copy, delim, token, false, false);
	printf("[str_chop_after(copy, delim, token, false, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());

	copy = input;
	str_chop_after(copy, delim, token, true, false);
	printf("[str_chop_afetr(copy, delim, token, true, false)]\n"
			"base:%s\ndelim:%s\ntoken:%s\n\n", copy.c_str(), delim.c_str(), token.c_str());
#endif
}

int main(int argc, char** argv)
{
	assert(false);
	if(argc <3 )
		return 1;
	test_str_stuff(argv[1], argv[2]);
	return 0;
}