Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: src/trusted/plugin/srpc/string_encoding_test.cc

Issue 2981011: Move plugin/srpc contents to the more appropriately named plugin/common.... (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/plugin/srpc/string_encoding.cc ('k') | src/trusted/plugin/srpc/utility.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/plugin/srpc/string_encoding_test.cc
===================================================================
--- src/trusted/plugin/srpc/string_encoding_test.cc (revision 2716)
+++ src/trusted/plugin/srpc/string_encoding_test.cc (working copy)
@@ -1,55 +0,0 @@
-/*
- * Copyright 2010 The Native Client Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can
- * be found in the LICENSE file.
- */
-
-#include <string.h>
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/src/trusted/plugin/srpc/string_encoding.h"
-
-
-int main() {
- const char* input;
- char* output;
- size_t output_size;
-
- // Valid input.
-
- input = "Hello world, \x80 and \xff";
- CHECK(plugin::ByteStringAsUTF8(input, strlen(input), &output, &output_size));
- CHECK(strcmp(output, "Hello world, \xc2\x80 and \xc3\xbf") == 0);
- CHECK(plugin::ByteStringFromUTF8(output, output_size, &output, &output_size));
- CHECK(strcmp(output, "Hello world, \x80 and \xff") == 0);
-
- // Valid UTF-8, but chars too big.
-
- // Three-byte sequence
- // This encodes \u1000
- input = "\xe1\x80\x80";
- CHECK(!plugin::ByteStringFromUTF8(input, strlen(input),
- &output, &output_size));
- // This encodes \u0100
- input = "\xc4\x80";
- CHECK(!plugin::ByteStringFromUTF8(input, strlen(input),
- &output, &output_size));
-
- // Invalid UTF-8.
-
- // Incomplete sequence
- input = "\xc2";
- CHECK(!plugin::ByteStringFromUTF8(input, strlen(input),
- &output, &output_size));
- // Subsequent byte is wrong
- input = "\xc2 ";
- CHECK(!plugin::ByteStringFromUTF8(input, strlen(input),
- &output, &output_size));
- // Over long encoding
- // This is a non-canonical encoding for \x00
- input = "\xc0\x80";
- CHECK(!plugin::ByteStringFromUTF8(input, strlen(input),
- &output, &output_size));
-
- return 0;
-}
« no previous file with comments | « src/trusted/plugin/srpc/string_encoding.cc ('k') | src/trusted/plugin/srpc/utility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698