Exemple #1
0
 */

#include <exception>
#include <iostream>
#include <string>
#include <vector>
#include "catch.hpp"
#include "GDCore/String.h"
#include <SFML/System/String.hpp>

TEST_CASE( "Utf8 String", "[common][utf8]") {
	SECTION("ctor & conversions") {
		gd::String str = u8"UTF8 a été testé !";

		sf::String sfStr = str;
		std::u32string u32str = str.ToUTF32();

		REQUIRE( str == gd::String::FromSfString(sfStr) );
		REQUIRE( str == gd::String::FromUTF32(u32str) );
	}

	SECTION("comparison operators") {
		REQUIRE( gd::String(u8"UTF8") == gd::String(u8"UTF8") );
		REQUIRE( gd::String(u8"UTF8") != gd::String(u8"UTF32") );
	}

	SECTION("size") {
		gd::String str = u8"UTF8 a été testé !";

		REQUIRE( str.size() == 18 );
	}