Explorar el Código

Fix tests building

Daniele Bartolini hace 12 años
padre
commit
d383c8a981
Se han modificado 3 ficheros con 46 adiciones y 45 borrados
  1. 2 1
      tests/messages.cpp
  2. 32 32
      tests/paths.cpp
  3. 12 12
      tests/strings.cpp

+ 2 - 1
tests/messages.cpp

@@ -2,6 +2,7 @@
 
 #include "Vec3.h"
 #include "OS.h"
+#include "NetAddress.h"
 #include "BitMessage.h"
 #include "MallocAllocator.h"
 
@@ -344,7 +345,7 @@ void test_net_address()
 	
 	printf("-----------------------------\n");
 	printf("start write and read for NET_ADDRESS\n");
-	printf("a = %d, b = %d, c = %d, d = %d, p = %d\n", res.address[0], res.address[1], res.address[2], res.address[3], res.port);
+	printf("a = %d, b = %d, c = %d, d = %d, p = %d\n", res.m_address[0], res.m_address[1], res.m_address[2], res.m_address[3], res.m_port);
 	printf("bits written = %d\n", bits_written);
 	printf("remaining write bits = %d\n", rem_write_bits);
 	printf("bits read = %d\n", bits_read);

+ 32 - 32
tests/paths.cpp

@@ -10,99 +10,99 @@ int main()
 	char path_output[128];
 	
 	// Test is_valid_segment
-	CE_ASSERT(path::is_valid_segment(".") == false);
+	CE_ASSERT(path::is_valid_segment(".") == false, "");
 	
-	CE_ASSERT(path::is_valid_segment("/") == false);
+	CE_ASSERT(path::is_valid_segment("/") == false, "");
 	
-	CE_ASSERT(path::is_valid_segment("\\") == false);
+	CE_ASSERT(path::is_valid_segment("\\") == false, "");
 
-	CE_ASSERT(path::is_valid_segment(":") == false);
+	CE_ASSERT(path::is_valid_segment(":") == false, "");
 	
-	CE_ASSERT(path::is_valid_segment("tga/") == false);
+	CE_ASSERT(path::is_valid_segment("tga/") == false, "");
 	
-	CE_ASSERT(path::is_valid_segment("tga\\foo") == false);
+	CE_ASSERT(path::is_valid_segment("tga\\foo") == false, "");
 	
-	CE_ASSERT(path::is_valid_segment("tga") == true);
+	CE_ASSERT(path::is_valid_segment("tga") == true, "");
 	
-	CE_ASSERT(path::is_valid_segment("back_texture") == true);
+	CE_ASSERT(path::is_valid_segment("back_texture") == true, "");
 	
 	// Test pathname
 	path::pathname("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("/home/project", path_output) == 0);
+	CE_ASSERT(string::strcmp("/home/project", path_output) == 0, "");
 
 	path::pathname("/home/project", path_output, 128);
-	CE_ASSERT(string::strcmp("/home", path_output) == 0);
+	CE_ASSERT(string::strcmp("/home", path_output) == 0, "");
 	
 	path::pathname("/home", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	path::pathname("/", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	path::pathname("", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	// Test filename
 	path::filename("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("texture.tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("texture.tga", path_output) == 0, "");
 	
 	path::filename("/home/project/texture", path_output, 128);
-	CE_ASSERT(string::strcmp("texture", path_output) == 0);
+	CE_ASSERT(string::strcmp("texture", path_output) == 0, "");
 	
 	path::filename("/home", path_output, 128);
-	CE_ASSERT(string::strcmp("home", path_output) == 0);
+	CE_ASSERT(string::strcmp("home", path_output) == 0, "");
 	
 	path::filename("/", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	path::filename("", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 
 	// Test basename
 	path::basename("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("texture", path_output) == 0);
+	CE_ASSERT(string::strcmp("texture", path_output) == 0, "");
 	
 	path::basename("/home/project/textureabc", path_output, 128);
 	printf(path_output);
-	CE_ASSERT(string::strcmp("textureabc", path_output) == 0);
+	CE_ASSERT(string::strcmp("textureabc", path_output) == 0, "");
 	
 	path::basename("/hom.e/proj./e.ct/textu.reabc", path_output, 128);
-	CE_ASSERT(string::strcmp("textu", path_output) == 0);
+	CE_ASSERT(string::strcmp("textu", path_output) == 0, "");
 	
 	path::basename("texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("texture", path_output) == 0);
+	CE_ASSERT(string::strcmp("texture", path_output) == 0, "");
 	
 	path::basename("/home", path_output, 128);
-	CE_ASSERT(string::strcmp("home", path_output) == 0);
+	CE_ASSERT(string::strcmp("home", path_output) == 0, "");
 	
 	path::basename("/", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	path::basename("", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	// Test extension
 	path::extension("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("tga", path_output) == 0, "");
 	
 	path::extension("/home/project/texture", path_output, 128);
-	CE_ASSERT(string::strcmp("", path_output) == 0);
+	CE_ASSERT(string::strcmp("", path_output) == 0, "");
 	
 	path::extension("/home/project.x/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("tga", path_output) == 0, "");
 	
 	// Test filename_without_extension
 	path::filename_without_extension("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("/home/project/texture", path_output) == 0);
+	CE_ASSERT(string::strcmp("/home/project/texture", path_output) == 0, "");
 	
 	// Test strip_trailing_separator
 	path::strip_trailing_separator("/home/project/texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("/home/project/texture.tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("/home/project/texture.tga", path_output) == 0, "");
 	
 	path::strip_trailing_separator("/home/project/texture2.tga/", path_output, 128);
-	CE_ASSERT(string::strcmp("/home/project/texture2.tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("/home/project/texture2.tga", path_output) == 0, "");
 	
 	path::strip_trailing_separator("texture.tga", path_output, 128);
-	CE_ASSERT(string::strcmp("texture.tga", path_output) == 0);
+	CE_ASSERT(string::strcmp("texture.tga", path_output) == 0, "");
 }
 

+ 12 - 12
tests/strings.cpp

@@ -10,40 +10,40 @@ const char* path_string = "/home/project/texture.tga";
 int main()
 {
 	// Test strlen
-	CE_ASSERT(string::strlen("ciao") == 4);
+	CE_ASSERT(string::strlen("ciao") == 4, "");
 	// FIXME add UTF-8 test case
 
 	// Test begin/end
-	CE_ASSERT(string::begin(hello_string) == &hello_string[0]);
+	CE_ASSERT(string::begin(hello_string) == &hello_string[0], "");
 	
-	CE_ASSERT(string::end(hello_string) == &hello_string[24] + 2);
+	CE_ASSERT(string::end(hello_string) == &hello_string[24] + 2, "");
 	
 	// Test find_first/find_last
-	CE_ASSERT(string::find_first(hello_string, '.') == &hello_string[2]);
+	CE_ASSERT(string::find_first(hello_string, '.') == &hello_string[2], "");
 	
-	CE_ASSERT(string::find_last(hello_string, '.') == &hello_string[17]);
+	CE_ASSERT(string::find_last(hello_string, '.') == &hello_string[17], "");
 	
-	CE_ASSERT(string::find_first(hello_string, '?') == string::end(hello_string));
+	CE_ASSERT(string::find_first(hello_string, '?') == string::end(hello_string), "");
 	
-	CE_ASSERT(string::find_last(hello_string, '?') == string::end(hello_string));
+	CE_ASSERT(string::find_last(hello_string, '?') == string::end(hello_string), "");
 	
-	CE_ASSERT(string::find_last(hello_string, '/') == &hello_string[22]);
+	CE_ASSERT(string::find_last(hello_string, '/') == &hello_string[22], "");
 	
-	CE_ASSERT(string::find_last(path_string, '/') == &path_string[13]);
+	CE_ASSERT(string::find_last(path_string, '/') == &path_string[13], "");
 	
 	// Test substring
 	char string_buffer[64];
 	
 	memset(string_buffer, 'a', 64);
 	string::substring(string::begin(hello_string), string::end(hello_string), string_buffer, 64);
-	CE_ASSERT(string::strcmp(hello_string, string_buffer) == 0);
+	CE_ASSERT(string::strcmp(hello_string, string_buffer) == 0, "");
 	
 	memset(string_buffer, 'a', 64);
 	string::substring(string::begin(hello_string), &hello_string[11], string_buffer, 64);
-	CE_ASSERT(string::strcmp(string_buffer, "/h.ello.eve") == 0);
+	CE_ASSERT(string::strcmp(string_buffer, "/h.ello.eve") == 0, "");
 	
 	memset(string_buffer, 'a', 64);
 	string::substring(string::begin(hello_string), string::end(hello_string), string_buffer, 5);
-	CE_ASSERT(string::strcmp(string_buffer, "/h.el") == 0);
+	CE_ASSERT(string::strcmp(string_buffer, "/h.el") == 0, "");
 }