Browse Source

Improved readability using string_length to avoid confusion with lists.

David Piuva 5 years ago
parent
commit
fb5a8b4a9c

+ 2 - 2
Source/DFPSR/api/imageAPI.cpp

@@ -459,7 +459,7 @@ String dsr::image_toAscii(const ImageU8& image, const String& alphabet) {
 	}
 	}
 	String result;
 	String result;
 	char alphabetMap[256];
 	char alphabetMap[256];
-	int alphabetSize = alphabet.length();
+	int alphabetSize = string_length(alphabet);
 	int width = image_getWidth(image);
 	int width = image_getWidth(image);
 	int height = image_getHeight(image);
 	int height = image_getHeight(image);
 	result.reserve(((width + 4) * height) + alphabetSize + 5);
 	result.reserve(((width + 4) * height) + alphabetSize + 5);
@@ -502,7 +502,7 @@ AlignedImageU8 dsr::image_fromAscii(const String& content) {
 	int width = 0;
 	int width = 0;
 	int height = 0;
 	int height = 0;
 	int alphabetSize = 0;
 	int alphabetSize = 0;
-	int contentSize = content.length();
+	int contentSize = string_length(content);
 	bool quoted = false;
 	bool quoted = false;
 	int i = 0;
 	int i = 0;
 	while (i < contentSize && ((current = content[i]) != '\0')) {
 	while (i < contentSize && ((current = content[i]) != '\0')) {

+ 1 - 1
Source/DFPSR/api/mediaMachineAPI.cpp

@@ -94,7 +94,7 @@ public:
 static const VMTypeDef mediaMachineTypes[] = {
 static const VMTypeDef mediaMachineTypes[] = {
 	VMTypeDef(U"FixedPoint", DataType_FixedPoint, true,
 	VMTypeDef(U"FixedPoint", DataType_FixedPoint, true,
 	[](VirtualMachine& machine, int globalIndex, const ReadableString& defaultValueText){
 	[](VirtualMachine& machine, int globalIndex, const ReadableString& defaultValueText){
-		FixedPoint defaultValue = defaultValueText.length() > 0 ? FixedPoint::fromText(defaultValueText) : FixedPoint();
+		FixedPoint defaultValue = string_length(defaultValueText) > 0 ? FixedPoint::fromText(defaultValueText) : FixedPoint();
 		List<VMA> args;
 		List<VMA> args;
 		args.pushConstruct(DataType_FixedPoint, globalIndex);
 		args.pushConstruct(DataType_FixedPoint, globalIndex);
 		args.pushConstruct(defaultValue);
 		args.pushConstruct(defaultValue);

+ 3 - 3
Source/DFPSR/font/Font.cpp

@@ -135,7 +135,7 @@ static void tabJump(int &x, int leftOrigin, int tabWidth) {
 
 
 void RasterFontImpl::printLine(ImageRgbaU8& target, const ReadableString& content, const IVector2D& location, const ColorRgbaI32& color) const {
 void RasterFontImpl::printLine(ImageRgbaU8& target, const ReadableString& content, const IVector2D& location, const ColorRgbaI32& color) const {
 	IVector2D currentLocation = location;
 	IVector2D currentLocation = location;
-	for (int i = 0; i < content.length(); i++) {
+	for (int i = 0; i < string_length(content); i++) {
 		DsrChar code = content[i];
 		DsrChar code = content[i];
 		if (code == 9) { // Tab
 		if (code == 9) { // Tab
 			tabJump(currentLocation.x, location.x, this->tabWidth);
 			tabJump(currentLocation.x, location.x, this->tabWidth);
@@ -156,7 +156,7 @@ void RasterFontImpl::printMultiLine(ImageRgbaU8& target, const ReadableString& c
 		// Not enough height to print anything
 		// Not enough height to print anything
 		return;
 		return;
 	}
 	}
-	for (int i = 0; i < content.length(); i++) {
+	for (int i = 0; i < string_length(content); i++) {
 		DsrChar code = content[i];
 		DsrChar code = content[i];
 		if (code == 10) {
 		if (code == 10) {
 			// Print the completed line
 			// Print the completed line
@@ -210,7 +210,7 @@ void RasterFontImpl::printMultiLine(ImageRgbaU8& target, const ReadableString& c
 
 
 int32_t RasterFontImpl::getLineWidth(const ReadableString& content) const {
 int32_t RasterFontImpl::getLineWidth(const ReadableString& content) const {
 	int32_t result = 0;
 	int32_t result = 0;
-	for (int i = 0; i < content.length(); i++) {
+	for (int i = 0; i < string_length(content); i++) {
 		DsrChar code = content[i];
 		DsrChar code = content[i];
 		if (code == 9) { // Tab
 		if (code == 9) { // Tab
 			tabJump(result, 0, this->tabWidth);
 			tabJump(result, 0, this->tabWidth);

+ 1 - 1
Source/DFPSR/gui/components/Button.cpp

@@ -54,7 +54,7 @@ static OrderedImageRgbaU8 generateButtonImage(MediaMethod imageGenerator, int pr
 	// Create a scaled image
 	// Create a scaled image
 	OrderedImageRgbaU8 result;
 	OrderedImageRgbaU8 result;
  	imageGenerator(width, height, pressed, backColor.red, backColor.green, backColor.blue)(result);
  	imageGenerator(width, height, pressed, backColor.red, backColor.green, backColor.blue)(result);
-	if (text.length() > 0) {
+	if (string_length(text) > 0) {
 		int left = (image_getWidth(result) - font_getLineWidth(font, text)) / 2;
 		int left = (image_getWidth(result) - font_getLineWidth(font, text)) / 2;
 		int top = (image_getHeight(result) - font_getSize(font)) / 2;
 		int top = (image_getHeight(result) - font_getSize(font)) / 2;
 		if (pressed) {
 		if (pressed) {

+ 1 - 1
Source/DFPSR/gui/components/Label.cpp

@@ -55,7 +55,7 @@ bool Label::isContainer() const {
 
 
 void Label::drawSelf(ImageRgbaU8& targetImage, const IRect &relativeLocation) {
 void Label::drawSelf(ImageRgbaU8& targetImage, const IRect &relativeLocation) {
 	completeAssets();
 	completeAssets();
-	if (this->text.value.length() > 0) {
+	if (string_length(this->text.value) > 0) {
 		// Uncomment to draw a white background for debugging
 		// Uncomment to draw a white background for debugging
 		//draw_rectangle(targetImage, relativeLocation, ColorRgbaI32(255, 255, 255, 255));
 		//draw_rectangle(targetImage, relativeLocation, ColorRgbaI32(255, 255, 255, 255));
 		// Print the text directly each time without buffering, because the biggest cost is to fill pixels
 		// Print the text directly each time without buffering, because the biggest cost is to fill pixels

+ 5 - 5
Source/DFPSR/machine/VirtualMachine.cpp

@@ -54,7 +54,7 @@ VirtualMachine::VirtualMachine(const ReadableString& code, const std::shared_ptr
 			ReadableString argumentLine = string_after(currentLine, colonIndex);
 			ReadableString argumentLine = string_after(currentLine, colonIndex);
 			string_split_inPlace(arguments, argumentLine, U',');
 			string_split_inPlace(arguments, argumentLine, U',');
 			this->interpretMachineWord(command, arguments);
 			this->interpretMachineWord(command, arguments);
-		} else if (currentLine.length() > 0) {
+		} else if (string_length(currentLine) > 0) {
 			throwError("Unexpected line \"", currentLine, "\".\n");
 			throwError("Unexpected line \"", currentLine, "\".\n");
 		}
 		}
 	}
 	}
@@ -173,7 +173,7 @@ Variable* VirtualMachine::declareVariable(int methodIndex, AccessType access, co
 		// Loop over type definitions to find a match
 		// Loop over type definitions to find a match
 		const VMTypeDef* typeDef = getMachineType(typeName);
 		const VMTypeDef* typeDef = getMachineType(typeName);
 		if (typeDef) {
 		if (typeDef) {
-			if (defaultValueText.length() > 0 && !typeDef->allowDefaultValue) {
+			if (string_length(defaultValueText) > 0 && !typeDef->allowDefaultValue) {
 				throwError("The variable \"", name, "\" doesn't have an immediate constructor for \"", typeName, "\".\n");
 				throwError("The variable \"", name, "\" doesn't have an immediate constructor for \"", typeName, "\".\n");
 			}
 			}
 			return this->declareVariable_aux(*typeDef, methodIndex, access, name, initialize, defaultValueText);
 			return this->declareVariable_aux(*typeDef, methodIndex, access, name, initialize, defaultValueText);
@@ -198,7 +198,7 @@ VMA VirtualMachine::VMAfromText(int methodIndex, const ReadableString& content)
 			ReadableString name = string_removeOuterWhiteSpace(string_before(content, leftIndex));
 			ReadableString name = string_removeOuterWhiteSpace(string_before(content, leftIndex));
 			ReadableString typeName = string_removeOuterWhiteSpace(string_inclusiveRange(content, leftIndex + 1, rightIndex - 1));
 			ReadableString typeName = string_removeOuterWhiteSpace(string_inclusiveRange(content, leftIndex + 1, rightIndex - 1));
 			ReadableString remainder = string_removeOuterWhiteSpace(string_after(content, rightIndex));
 			ReadableString remainder = string_removeOuterWhiteSpace(string_after(content, rightIndex));
-			if (remainder.length() > 0) {
+			if (string_length(remainder) > 0) {
 				throwError("No code allowed after > for in-place temp declarations!\n");
 				throwError("No code allowed after > for in-place temp declarations!\n");
 			}
 			}
 			Variable* resource = this->declareVariable(methodIndex, AccessType::Hidden, typeName, name, false, U"");
 			Variable* resource = this->declareVariable(methodIndex, AccessType::Hidden, typeName, name, false, U"");
@@ -273,7 +273,7 @@ void VirtualMachine::addCallInstructions(const List<ReadableString>& arguments)
 	int outputCount = 0;
 	int outputCount = 0;
 	for (int a = 1; a < arguments.length(); a++) {
 	for (int a = 1; a < arguments.length(); a++) {
 		ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
 		ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
-		if (content.length() > 0) {
+		if (string_length(content) > 0) {
 			if (outputCount < calledMethod->outputCount) {
 			if (outputCount < calledMethod->outputCount) {
 				outputArguments.push(this->VMAfromText(currentMethodIndex, getArg(arguments, a)));
 				outputArguments.push(this->VMAfromText(currentMethodIndex, getArg(arguments, a)));
 				outputCount++;
 				outputCount++;
@@ -396,7 +396,7 @@ void VirtualMachine::interpretMachineWord(const ReadableString& command, const L
 		List<VMA> resolvedArguments;
 		List<VMA> resolvedArguments;
 		for (int a = 0; a < arguments.length(); a++) {
 		for (int a = 0; a < arguments.length(); a++) {
 			ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
 			ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
-			if (content.length() > 0) {
+			if (string_length(content) > 0) {
 				resolvedArguments.push(this->VMAfromText(methodIndex, getArg(arguments, a)));
 				resolvedArguments.push(this->VMAfromText(methodIndex, getArg(arguments, a)));
 			}
 			}
 		}
 		}

+ 1 - 1
Source/DFPSR/math/FixedPoint.cpp

@@ -265,7 +265,7 @@ FixedPoint FixedPoint::fromText(const ReadableString& text) {
 		int64_t wholeInteger = string_parseInteger(string_before(content, decimal));
 		int64_t wholeInteger = string_parseInteger(string_before(content, decimal));
 		ReadableString decimals = string_after(content, decimal);
 		ReadableString decimals = string_after(content, decimal);
 		uint64_t fraction = 0; // Extra high precision for accumulation
 		uint64_t fraction = 0; // Extra high precision for accumulation
-		for (int i = 0; i < decimals.length(); i++) {
+		for (int i = 0; i < string_length(decimals); i++) {
 			DsrChar digit = decimals[i];
 			DsrChar digit = decimals[i];
 			if (digit >= U'1' && digit <= U'9') {
 			if (digit >= U'1' && digit <= U'9') {
 				fraction += getDecimalFraction64(i, digit - U'0');
 				fraction += getDecimalFraction64(i, digit - U'0');

+ 1 - 1
Source/DFPSR/persistent/atomic/PersistentStringList.cpp

@@ -34,7 +34,7 @@ bool PersistentStringList::assignValue(const ReadableString &text) {
 	bool hadComma = false;
 	bool hadComma = false;
 	int start = 0;
 	int start = 0;
 	this->value.clear();
 	this->value.clear();
-	for (int i = 0; i < text.length(); i++) {
+	for (int i = 0; i < string_length(text); i++) {
 		DsrChar c = text[i];
 		DsrChar c = text[i];
 		if (quoted) {
 		if (quoted) {
 			if (c == U'\\') { // Escape sequence
 			if (c == U'\\') { // Escape sequence

+ 1 - 1
Source/DFPSR/render/ResourcePool.cpp

@@ -41,7 +41,7 @@ int BasicResourcePool::findImageRgba(const String& name) const {
 const ImageRgbaU8 BasicResourcePool::fetchImageRgba(const String& name) {
 const ImageRgbaU8 BasicResourcePool::fetchImageRgba(const String& name) {
 	ImageRgbaU8 result;
 	ImageRgbaU8 result;
 	// Using "" will return an empty reference to allow removing textures
 	// Using "" will return an empty reference to allow removing textures
-	if (name.length() > 0) {
+	if (string_length(name) > 0) {
 		int existingIndex = this->findImageRgba(name);
 		int existingIndex = this->findImageRgba(name);
 		if (existingIndex > -1) {
 		if (existingIndex > -1) {
 			result = imageRgbaList[existingIndex].ref;
 			result = imageRgbaList[existingIndex].ref;

+ 2 - 2
Source/DFPSR/render/model/format/dmf1.cpp

@@ -273,7 +273,7 @@ static void readToken(ParserState &state, const String &fileContent, int start,
 static Model_DMF1 loadNative_DMF1(const String &fileContent) {
 static Model_DMF1 loadNative_DMF1(const String &fileContent) {
 	Model_DMF1 resultModel;
 	Model_DMF1 resultModel;
 	ParserState state(&resultModel);
 	ParserState state(&resultModel);
-	if (fileContent.length() < 4 || (fileContent[0] != 'D' || fileContent[1] != 'M' || fileContent[2] != 'F' || fileContent[3] != '1')) {
+	if (string_length(fileContent) < 4 || (fileContent[0] != 'D' || fileContent[1] != 'M' || fileContent[2] != 'F' || fileContent[3] != '1')) {
 		printText("The file does not start with \"DMF1\"!\n");
 		printText("The file does not start with \"DMF1\"!\n");
 		return resultModel;
 		return resultModel;
 	}
 	}
@@ -281,7 +281,7 @@ static Model_DMF1 loadNative_DMF1(const String &fileContent) {
 	int readIndex = 4;
 	int readIndex = 4;
 	// Scan the string and send tokens to the state machine
 	// Scan the string and send tokens to the state machine
 	DsrChar firstCharOfToken = U'\0';
 	DsrChar firstCharOfToken = U'\0';
-	for (readIndex = tokenStart; readIndex < fileContent.length(); readIndex++) {
+	for (readIndex = tokenStart; readIndex < string_length(fileContent); readIndex++) {
 		DsrChar curChar = fileContent[readIndex];
 		DsrChar curChar = fileContent[readIndex];
 		if (firstCharOfToken == U'\0' && (curChar == tab || curChar == space || curChar == lineFeed || curChar == carriageReturn)) {
 		if (firstCharOfToken == U'\0' && (curChar == tab || curChar == space || curChar == lineFeed || curChar == carriageReturn)) {
 			// Finish the current token and don't save this character
 			// Finish the current token and don't save this character

+ 1 - 1
Source/SDK/sandbox/sprite/orthoAPI.h

@@ -190,7 +190,7 @@ public:
 	}
 	}
 	explicit OrthoSystem(const ReadableString& content) {
 	explicit OrthoSystem(const ReadableString& content) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
-			if (block.length() == 0) {
+			if (string_length(block) == 0) {
 				if (string_caseInsensitiveMatch(key, U"DownTiltPerThousand")) {
 				if (string_caseInsensitiveMatch(key, U"DownTiltPerThousand")) {
 					this->cameraTilt = (float)string_parseInteger(value) * -0.001f;
 					this->cameraTilt = (float)string_parseInteger(value) * -0.001f;
 				} else if (string_caseInsensitiveMatch(key, U"PixelsPerTile")) {
 				} else if (string_caseInsensitiveMatch(key, U"PixelsPerTile")) {

+ 4 - 4
Source/SDK/sandbox/sprite/spriteAPI.cpp

@@ -20,7 +20,7 @@ struct SpriteConfig {
 	: centerX(centerX), centerY(centerY), frameRows(frameRows), propertyColumns(propertyColumns), minBound(minBound), maxBound(maxBound) {}
 	: centerX(centerX), centerY(centerY), frameRows(frameRows), propertyColumns(propertyColumns), minBound(minBound), maxBound(maxBound) {}
 	explicit SpriteConfig(const ReadableString& content) {
 	explicit SpriteConfig(const ReadableString& content) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
-			if (block.length() == 0) {
+			if (string_length(block) == 0) {
 				if (string_caseInsensitiveMatch(key, U"CenterX")) {
 				if (string_caseInsensitiveMatch(key, U"CenterX")) {
 					this->centerX = string_parseInteger(value);
 					this->centerX = string_parseInteger(value);
 				} else if (string_caseInsensitiveMatch(key, U"CenterY")) {
 				} else if (string_caseInsensitiveMatch(key, U"CenterY")) {
@@ -962,7 +962,7 @@ static bool isValue(DsrChar c) {
 // Allowing the last decimals to deviate a bit because floating-point operations are rounded differently between computers
 // Allowing the last decimals to deviate a bit because floating-point operations are rounded differently between computers
 static bool approximateTextMatch(const ReadableString &a, const ReadableString &b, double tolerance = 0.00002) {
 static bool approximateTextMatch(const ReadableString &a, const ReadableString &b, double tolerance = 0.00002) {
 	int readerA = 0, readerB = 0;
 	int readerA = 0, readerB = 0;
-	while (readerA < a.length() && readerB < b.length()) {
+	while (readerA < string_length(a) && readerB < string_length(b)) {
 		DsrChar charA = a[readerA];
 		DsrChar charA = a[readerA];
 		DsrChar charB = b[readerB];
 		DsrChar charB = b[readerB];
 		if (isValue(charA) && isValue(charB)) {
 		if (isValue(charA) && isValue(charB)) {
@@ -994,7 +994,7 @@ static bool approximateTextMatch(const ReadableString &a, const ReadableString &
 		readerA++;
 		readerA++;
 		readerB++;
 		readerB++;
 	}
 	}
-	if (readerA < a.length() - 1 || readerB < b.length() - 1) {
+	if (readerA < string_length(a) - 1 || readerB < string_length(b) - 1) {
 		// One text had unmatched remains after the other reached its end
 		// One text had unmatched remains after the other reached its end
 		return false;
 		return false;
 	} else {
 	} else {
@@ -1007,7 +1007,7 @@ void sprite_generateFromModel(const Model& visibleModel, const Model& shadowMode
 	ImageRgbaU8 atlasImage; String configText;
 	ImageRgbaU8 atlasImage; String configText;
 	sprite_generateFromModel(atlasImage, configText, visibleModel, shadowModel, ortho, targetPath, cameraAngles);
 	sprite_generateFromModel(atlasImage, configText, visibleModel, shadowModel, ortho, targetPath, cameraAngles);
 	// Save the result on success
 	// Save the result on success
-	if (configText.length() > 0) {
+	if (string_length(configText) > 0) {
 		// Save the atlas
 		// Save the atlas
 		String atlasPath = targetPath + U".png";
 		String atlasPath = targetPath + U".png";
 		// Try loading any existing image
 		// Try loading any existing image

+ 1 - 1
Source/SDK/sandbox/tool.cpp

@@ -733,7 +733,7 @@ static void parse_dsm(ParserState& state, const ReadableString& content) {
 		if (commentIndex > -1) {
 		if (commentIndex > -1) {
 			line = string_removeOuterWhiteSpace(string_before(line, commentIndex));
 			line = string_removeOuterWhiteSpace(string_before(line, commentIndex));
 		}
 		}
-		if (line.length() > 0) {
+		if (string_length(line) > 0) {
 			// Find assignments
 			// Find assignments
 			int assignmentIndex = string_findFirst(line, U'=');
 			int assignmentIndex = string_findFirst(line, U'=');
 			int colonIndex = string_findFirst(line, U':');
 			int colonIndex = string_findFirst(line, U':');

+ 13 - 5
Source/test/tests/StringTest.cpp

@@ -15,12 +15,20 @@ void fooInPlace(dsr::String& target, const dsr::ReadableString& a, const dsr::Re
 
 
 dsr::String foo(const dsr::ReadableString& a, const dsr::ReadableString& b) {
 dsr::String foo(const dsr::ReadableString& a, const dsr::ReadableString& b) {
 	dsr::String result;
 	dsr::String result;
-	result.reserve(string_length(a) + string_length(b));
+	result.reserve(string_length(a) + string_length(b) + 6);
 	fooInPlace(result, a, b);
 	fooInPlace(result, a, b);
 	return result;
 	return result;
 }
 }
 
 
 START_TEST(String)
 START_TEST(String)
+	{ // Length
+		ASSERT_EQUAL(string_length(dsr::String()), 0);
+		ASSERT_EQUAL(string_length(U""), 0);
+		ASSERT_EQUAL(string_length(U"a"), 1);
+		ASSERT_EQUAL(string_length(U"ab"), 2);
+		ASSERT_EQUAL(string_length(U"abc"), 3);
+		ASSERT_EQUAL(string_length(U"0123456789"), 10);
+	}
 	{ // Comparison
 	{ // Comparison
 		dsr::ReadableString litA = U"Testing \u0444";
 		dsr::ReadableString litA = U"Testing \u0444";
 		dsr::ReadableString litB = U"Testing ф";
 		dsr::ReadableString litB = U"Testing ф";
@@ -154,26 +162,26 @@ START_TEST(String)
 	{ // Splitting
 	{ // Splitting
 		List<ReadableString> result;
 		List<ReadableString> result;
 		string_split_inPlace(result, U"a.b.c.d", U'.');
 		string_split_inPlace(result, U"a.b.c.d", U'.');
-		ASSERT_EQUAL(string_length(result), 4);
+		ASSERT_EQUAL(result.length(), 4);
 		ASSERT_MATCH(result[0], U"a");
 		ASSERT_MATCH(result[0], U"a");
 		ASSERT_MATCH(result[1], U"b");
 		ASSERT_MATCH(result[1], U"b");
 		ASSERT_MATCH(result[2], U"c");
 		ASSERT_MATCH(result[2], U"c");
 		ASSERT_MATCH(result[3], U"d");
 		ASSERT_MATCH(result[3], U"d");
 		String content = U"One Two Three";
 		String content = U"One Two Three";
 		result = string_split(content, U' ');
 		result = string_split(content, U' ');
-		ASSERT_EQUAL(string_length(result), 3);
+		ASSERT_EQUAL(result.length(), 3);
 		ASSERT_MATCH(result[0], U"One");
 		ASSERT_MATCH(result[0], U"One");
 		ASSERT_MATCH(result[1], U"Two");
 		ASSERT_MATCH(result[1], U"Two");
 		ASSERT_MATCH(result[2], U"Three");
 		ASSERT_MATCH(result[2], U"Three");
 		string_split_inPlace(result, U"Four.Five", U'.', true);
 		string_split_inPlace(result, U"Four.Five", U'.', true);
-		ASSERT_EQUAL(string_length(result), 5);
+		ASSERT_EQUAL(result.length(), 5);
 		ASSERT_MATCH(result[0], U"One");
 		ASSERT_MATCH(result[0], U"One");
 		ASSERT_MATCH(result[1], U"Two");
 		ASSERT_MATCH(result[1], U"Two");
 		ASSERT_MATCH(result[2], U"Three");
 		ASSERT_MATCH(result[2], U"Three");
 		ASSERT_MATCH(result[3], U"Four");
 		ASSERT_MATCH(result[3], U"Four");
 		ASSERT_MATCH(result[4], U"Five");
 		ASSERT_MATCH(result[4], U"Five");
 		string_split_inPlace(result, U" 1 | 2 ", U'|');
 		string_split_inPlace(result, U" 1 | 2 ", U'|');
-		ASSERT_EQUAL(string_length(result), 2);
+		ASSERT_EQUAL(result.length(), 2);
 		ASSERT_MATCH(result[0], U" 1 ");
 		ASSERT_MATCH(result[0], U" 1 ");
 		ASSERT_MATCH(result[1], U" 2 ");
 		ASSERT_MATCH(result[1], U" 2 ");
 	}
 	}