File: punycode.h

package info (click to toggle)
scummvm 2.9.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 450,268 kB
  • sloc: cpp: 4,297,604; asm: 28,322; python: 12,901; sh: 11,219; java: 8,477; xml: 7,843; perl: 2,633; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (42 lines) | stat: -rw-r--r-- 1,775 bytes parent folder | download | duplicates (3)
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
#include <cxxtest/TestSuite.h>
#include "common/punycode.h"

/**
 * Test suite for the functions in common/util.h
 */
static const char *strings[] = {
	"Icon\r", "xn--Icon-ja6e", "1",
	"ascii", "ascii", "0",
	"ends with dot .", "xn--ends with dot .-", "1",
	"ends with space ", "xn--ends with space -", "1",
	"バッドデイ(Power PC)", "xn--(Power PC)-jx4ilmwb1a7h", "1",
	"Hello*", "xn--Hello-la10a", "1",
	"File I/O", "xn--File IO-oa82b", "1",
	"HDにコピーして下さい。G3", "xn--HDG3-rw3c5o2dpa9kzb2170dd4tzyda5j4k", "1",
	"Buried in Time™ Demo", "xn--Buried in Time Demo-eo0l", "1",
	"•Main Menu", "xn--Main Menu-zd0e", "1",
	"Spaceship Warlock™", "xn--Spaceship Warlock-306j", "1",
	"ワロビージャックの大冒険<デモ>", "xn--baa0pja0512dela6bueub9gshf1k1a1rt742c060a2x4u", "1",
	"Jönssonligan går på djupet.exe", "xn--Jnssonligan gr p djupet.exe-glcd70c", "1",
	"Jönssonligan.exe", "xn--Jnssonligan.exe-8sb", "1",
	"G3フォルダ", "xn--G3-3g4axdtexf", "1",
	"Big[test]", "Big[test]", "0",
	"Where \\ Do <you> Want / To: G* ? ;Unless=nowhere,or|\"(everything)/\":*|\\?%<>,;=", "xn--Where  Do you Want  To G  ;Unless=nowhere,or(everything),;=-5baedgdcbtamaaaaaaaaa99woa3wnnmb82aqb71ekb9g3c1f1cyb7bx6rfcv2pxa", "1",
	"Buried in Timeェ Demo", "xn--Buried in Time Demo-yp97h", "1",
	0
};
class PunycodeTestSuite : public CxxTest::TestSuite {
	public:

	void test_punycode() {
		for (const char **a = strings; *a; a += 3) {
			Common::U32String string_in(a[0]);
			Common::String string_out(a[1]);
			bool need = (a[2][0] == '1');

			TS_ASSERT_EQUALS(punycode_decodefilename(string_out), string_in);
			TS_ASSERT_EQUALS(punycode_encodefilename(string_in), string_out);
			TS_ASSERT_EQUALS(punycode_needEncode(string_in), need);
		}
	}
};