-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathunittest
executable file
·98 lines (83 loc) · 14.6 KB
/
unittest
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/php
<?php
define('COMMAND', './test/test.o');
check_command_file();
$patterns = array(
"[i][c=29][c=28][c=11][c=48][c=47][i](L)[c=6][c=9][c=13][c=30]S[/c]3[/c]R[/c]3[/c][/i]N[/c]3[/c]L[/c]L[/c]A[/c][/i]" => '<i><span foreground="#ff62ff"><span foreground="#ff6d66"><span foreground="#00FFFF"><span foreground="#0000d3"><span foreground="#de00de"><i>(L)<span foreground="#9A009A"><span foreground="#00FC00"><span foreground="#FF00FF"><span foreground="#6c6cff">S</span>3</span>R</span>3</span></i>N</span>3</span>L</span>L</span>A</span></i>',
"[c=1][b](¯`·._.·[♫_LUKE_♫]·._.·´¯)[/b][/c=9]" => '<b><span foreground="#000000">(</span><span foreground="#000a00">¯</span><span foreground="#001400">`</span><span foreground="#001e00">·</span><span foreground="#002800">.</span><span foreground="#003200">_</span><span foreground="#003c00">.</span><span foreground="#004600">·</span><span foreground="#005000">[</span><span foreground="#005a00">♫</span><span foreground="#006400">_</span><span foreground="#006e00">L</span><span foreground="#007800">U</span><span foreground="#008300">K</span><span foreground="#008d00">E</span><span foreground="#009700">_</span><span foreground="#00a100">♫</span><span foreground="#00ab00">]</span><span foreground="#00b500">·</span><span foreground="#00bf00">.</span><span foreground="#00c900">_</span><span foreground="#00d300">.</span><span foreground="#00dd00">·</span><span foreground="#00e700">´</span><span foreground="#00f100">¯</span><span foreground="#00fc00">)</span></b>',
"[c=#FF0080][b] .:。✿*゚ѕιмσиα.:。✿゚[/b][/c]" => '<span foreground="#FF0080"><b> .:。✿*゚ѕιмσиα.:。✿゚</b></span>',
"[b]grassetto[/b]" => '<b>grassetto</b>',
"[c=#FA0A64]Ale [/c]" => '<span foreground="#FA0A64">Ale </span>',
"[b][a=1][c=9]UnO.Ke.Si.KiAmA.[/c=2]AleX[/a=63][/b]" => '<b><span foreground="#00fc00" background="#000000">U</span><span foreground="#00ec08" background="#050005">n</span><span foreground="#00db10" background="#0a000a">O</span><span foreground="#00ca19" background="#0f000f">.</span><span foreground="#00b921" background="#140014">K</span><span foreground="#00a829" background="#190019">e</span><span foreground="#009832" background="#1e001e">.</span><span foreground="#00873a" background="#230024">S</span><span foreground="#007642" background="#280029">i</span><span foreground="#00654b" background="#2d002e">.</span><span foreground="#005453" background="#320033">K</span><span foreground="#00445b" background="#370038">i</span><span foreground="#003364" background="#3c003d">A</span><span foreground="#00226c" background="#410043">m</span><span foreground="#001174" background="#460048">A</span><span foreground="#00007d" background="#4b004d">.</span><span background="#500052">A</span><span background="#550057">l</span><span background="#5a005c">e</span><span background="#5f0162">X</span></b>',
"[c=9][a=1][b][i]-LuKe-[/i][/b][/a][/c]" => '<span foreground="#00FC00"><span background="#000000"><b><i>-LuKe-</i></b></span></span>',
"[c=46][a=1] ♥---==-♥°° ♥††♠Silvia♠††♥°°♥-=...[/a=46][/c=1]" => '<span foreground="#eb0505" background="#000000"> </span><span foreground="#e40505" background="#070000">♥</span><span foreground="#dd0505" background="#0e0000">-</span><span foreground="#d60505" background="#150000">-</span><span foreground="#cf0505" background="#1c0000">-</span><span foreground="#c80505" background="#230000">=</span><span foreground="#c10505" background="#2a0000">=</span><span foreground="#ba0404" background="#310101">-</span><span foreground="#b30404" background="#380101">♥</span><span foreground="#ab0404" background="#400101">°</span><span foreground="#a40404" background="#470101">°</span><span foreground="#9d0404" background="#4e0101"> </span><span foreground="#960404" background="#550101">♥</span><span foreground="#8f0404" background="#5c0101">†</span><span foreground="#880303" background="#630202">†</span><span foreground="#810303" background="#6a0202">♠</span><span foreground="#7a0303" background="#710202">S</span><span foreground="#720303" background="#790202">i</span><span foreground="#6b0303" background="#800202">l</span><span foreground="#640303" background="#870202">v</span><span foreground="#5d0202" background="#8e0303">i</span><span foreground="#560202" background="#950303">a</span><span foreground="#4f0202" background="#9c0303">♠</span><span foreground="#480202" background="#a30303">†</span><span foreground="#410202" background="#aa0303">†</span><span foreground="#390202" background="#b20303">♥</span><span foreground="#320202" background="#b90303">°</span><span foreground="#2b0101" background="#c00404">°</span><span foreground="#240101" background="#c70404">♥</span><span foreground="#1d0101" background="#ce0404">-</span><span foreground="#160101" background="#d50404">=</span><span foreground="#0f0101" background="#dc0404">.</span><span foreground="#080101" background="#e30404">.</span><span foreground="#000000" background="#eb0505">.</span>',
"[c=7][b]©ίρο[/b][/c=45]" => '<b><span foreground="#fc7d00">©</span><span foreground="#f18006">ί</span><span foreground="#e5840c">ρ</span><span foreground="#d98812">ο</span></b>',
"[c=1][b][u]..:: *FùMiTsUki* ::.[/u][/b][/c=14]" => '<b><u><span foreground="#000000">.</span><span foreground="#060606">.</span><span foreground="#0d0d0d">:</span><span foreground="#131313">:</span><span foreground="#1a1a1a"> </span><span foreground="#202020">*</span><span foreground="#272727">F</span><span foreground="#2e2e2e">ù</span><span foreground="#343434">M</span><span foreground="#3b3b3b">i</span><span foreground="#414141">T</span><span foreground="#484848">s</span><span foreground="#4e4e4e">U</span><span foreground="#555555">k</span><span foreground="#5c5c5c">i</span><span foreground="#626262">*</span><span foreground="#696969"> </span><span foreground="#6f6f6f">:</span><span foreground="#767676">:</span><span foreground="#7d7d7d">.</span></u></b>',
"[c=9]prova <3[/c=2]" => '<span foreground="#00fc00">p</span><span foreground="#00d811">r</span><span foreground="#00b423">o</span><span foreground="#009035">v</span><span foreground="#006c47">a</span><span foreground="#004859"> </span><span foreground="#00246b"><</span><span foreground="#00007d">3</span>',
"[c=0]<>ciao & \" ' ( asd )[/c=1]" => '<span foreground="#ffffff"><</span><span foreground="#f2f2f2">></span><span foreground="#e5e5e5">c</span><span foreground="#d7d7d7">i</span><span foreground="#cacaca">a</span><span foreground="#bcbcbc">o</span><span foreground="#afafaf"> </span><span foreground="#a2a2a2">&</span><span foreground="#949494"> </span><span foreground="#878787">"</span><span foreground="#797979"> </span><span foreground="#6c6c6c">'</span><span foreground="#5e5e5e"> </span><span foreground="#515151">(</span><span foreground="#444444"> </span><span foreground="#363636">a</span><span foreground="#292929">s</span><span foreground="#1b1b1b">d</span><span foreground="#0e0e0e"> </span><span foreground="#000000">)</span>',
"[c=5][b][i]ReD - 20[/c][/b][/i] (B) @ WORK| www.myspace.com/masks_Insomnia x Foto" => '',
"(*)[b][c=#000066] frittomisto84 [/c=45][/b](*)" => '(*)<b><span foreground="#000066"> </span><span foreground="#0f0960">f</span><span foreground="#1f135a">r</span><span foreground="#2e1d54">i</span><span foreground="#3e264e">t</span><span foreground="#4d3048">t</span><span foreground="#5d3a42">o</span><span foreground="#6c443c">m</span><span foreground="#7c4d36">i</span><span foreground="#8b5730">s</span><span foreground="#9b612a">t</span><span foreground="#aa6a24">o</span><span foreground="#ba741e">8</span><span foreground="#c97e18">4</span><span foreground="#d98812"> </span></b>(*)',
"[Vhêmt]" => '[Vhêmt]',
"[c=1]ab[/c=2](*)" => '<span foreground="#000000">a</span><span foreground="#00007D">b</span>(*)',
"[c=1]ab[/c=2]aaaaaa" => '<span foreground="#000000">a</span><span foreground="#00007D">b</span>aaaaaa',
"[c=1][a=2]a[/a=0][/c=0]bcde" => '<span foreground="#000000" background="#00007d">a</span>bcde',
"[c=1]a[Vhêmt]b[/c=2]" => '<span foreground="#000000">a</span><span foreground="#00000f">[</span><span foreground="#00001f">V</span><span foreground="#00002e">h</span><span foreground="#00003e">ê</span><span foreground="#00004e">m</span><span foreground="#00005d">t</span><span foreground="#00006d">]</span><span foreground="#00007d">b</span>',
"[c=1][z][/c=0]" => '<span foreground="#000000">[</span><span foreground="#7f7f7f">z</span><span foreground="#ffffff">]</span>',
"[b][i][c=49][c=#0080FF][b](F)Alessandra(F) [/b][/c] (8)I wanna live like Music..." => '<b><i><span foreground="#03cc88"><span foreground="#0080ff"><b>(F)Alessandra(F) </b></span> (8)I wanna live like Music...',
"[i][c=4]Lo Ste[/c=1][/i] [-25!] {Creo}" => '<i><span foreground="#ff0000">L</span><span foreground="#cc0000">o</span><span foreground="#990000"> </span><span foreground="#660000">S</span><span foreground="#330000">t</span><span foreground="#000000">e</span></i> [-25!] {Creo}',
"[c=39]Nick...Io credo semplicemente che quello che non ti uccide, ti rende più... strano[/c=45]" => '<span foreground="#1e29ff">N</span><span foreground="#202afd">i</span><span foreground="#222bfa">c</span><span foreground="#242cf7">k</span><span foreground="#272df4">.</span><span foreground="#292ef1">.</span><span foreground="#2b30ee">.</span><span foreground="#2e31eb">I</span><span foreground="#3032e8">o</span><span foreground="#3233e5"> </span><span foreground="#3534e2">c</span><span foreground="#3735df">r</span><span foreground="#3937dc">e</span><span foreground="#3c38d9">d</span><span foreground="#3e39d7">o</span><span foreground="#403ad4"> </span><span foreground="#423bd1">s</span><span foreground="#453cce">e</span><span foreground="#473ecb">m</span><span foreground="#493fc8">p</span><span foreground="#4c40c5">l</span><span foreground="#4e41c2">i</span><span foreground="#5042bf">c</span><span foreground="#5343bc">e</span><span foreground="#5545b9">m</span><span foreground="#5746b6">e</span><span foreground="#5a47b3">n</span><span foreground="#5c48b0">t</span><span foreground="#5e49ae">e</span><span foreground="#604bab"> </span><span foreground="#634ca8">c</span><span foreground="#654da5">h</span><span foreground="#674ea2">e</span><span foreground="#6a4f9f"> </span><span foreground="#6c509c">q</span><span foreground="#6e5299">u</span><span foreground="#715396">e</span><span foreground="#735493">l</span><span foreground="#755590">l</span><span foreground="#78568d">o</span><span foreground="#7a578a"> </span><span foreground="#7c5988">c</span><span foreground="#7e5a85">h</span><span foreground="#815b82">e</span><span foreground="#835c7f"> </span><span foreground="#855d7c">n</span><span foreground="#885e79">o</span><span foreground="#8a6076">n</span><span foreground="#8c6173"> </span><span foreground="#8f6270">t</span><span foreground="#91636d">i</span><span foreground="#93646a"> </span><span foreground="#966567">u</span><span foreground="#986764">c</span><span foreground="#9a6861">c</span><span foreground="#9c695f">i</span><span foreground="#9f6a5c">d</span><span foreground="#a16b59">e</span><span foreground="#a36d56">,</span><span foreground="#a66e53"> </span><span foreground="#a86f50">t</span><span foreground="#aa704d">i</span><span foreground="#ad714a"> </span><span foreground="#af7247">r</span><span foreground="#b17444">e</span><span foreground="#b47541">n</span><span foreground="#b6763e">d</span><span foreground="#b8773b">e</span><span foreground="#ba7839"> </span><span foreground="#bd7936">p</span><span foreground="#bf7b33">i</span><span foreground="#c17c30">ù</span><span foreground="#c47d2d">.</span><span foreground="#c67e2a">.</span><span foreground="#c87f27">.</span><span foreground="#cb8024"> </span><span foreground="#cd8221">s</span><span foreground="#cf831e">t</span><span foreground="#d2841b">r</span><span foreground="#d48518">a</span><span foreground="#d68615">n</span><span foreground="#d98812">o</span>',
"[c=38][i](R).Fabbbbbrìì.(R) You Know You Love Me.[/i][/c=8]" => '<i><span foreground="#ff1eff">(</span><span foreground="#ff23f9">R</span><span foreground="#ff29f2">)</span><span foreground="#ff2fec">.</span><span foreground="#ff35e5">F</span><span foreground="#ff3adf">a</span><span foreground="#ff40d8">b</span><span foreground="#ff46d2">b</span><span foreground="#ff4ccb">b</span><span foreground="#ff51c5">b</span><span foreground="#ff57be">b</span><span foreground="#ff5db8">r</span><span foreground="#ff63b1">ì</span><span foreground="#ff69aa">ì</span><span foreground="#ff6ea4">.</span><span foreground="#ff749d">(</span><span foreground="#ff7a97">R</span><span foreground="#ff8090">)</span><span foreground="#ff858a"> </span><span foreground="#ff8b83">Y</span><span foreground="#ff917d">o</span><span foreground="#ff9776">u</span><span foreground="#ff9c70"> </span><span foreground="#ffa269">K</span><span foreground="#ffa863">n</span><span foreground="#ffae5c">o</span><span foreground="#ffb455">w</span><span foreground="#ffb94f"> </span><span foreground="#ffbf48">Y</span><span foreground="#ffc542">o</span><span foreground="#ffcb3b">u</span><span foreground="#ffd035"> </span><span foreground="#ffd62e">L</span><span foreground="#ffdc28">o</span><span foreground="#ffe221">v</span><span foreground="#ffe71b">e</span><span foreground="#ffed14"> </span><span foreground="#fff30e">M</span><span foreground="#fff907">e</span><span foreground="#ffff00">.</span></i>',
);
$counter = 1;
$num_errors = 0;
foreach ($patterns as $pattern => $expected) {
echo "Testing pattern $counter... ";
//test($pattern);
$result = test($pattern);
$result = preg_replace_callback('/(foreground|background)="(#.{6})"/', 'replace_lowercase', $result);
$expected = preg_replace_callback('/(foreground|background)="(#.{6})"/', 'replace_lowercase', $expected);
if ($result == $expected) {
echo "ok.\n";
}
else {
// Error
echo "ERROR.\n";
echo "PATTERN: $pattern\n";
echo "EXPECTED:\n";
echo "$expected\n";
echo "RESULT:\n";
echo "$result\n\n";
$num_errors++;
}
$counter++;
}
echo str_repeat('=', 60) . "\n";
echo "Total: " . sizeof($patterns) . "\n";
echo "Errors: $num_errors\n";
function replace_lowercase($matches) {
return "{$matches[1]}=\"" . strtolower($matches[2]) . "\"";
}
function test($pattern) {
$pattern = str_replace('"', '\"', $pattern);
$pattern = str_replace('`', '\`', $pattern);
return execute(COMMAND . " \"$pattern\"");
}
function execute($command, $keep_newlines = false) {
$output = `$command`;
if (!$keep_newlines)
$output = preg_replace("/\n/", '', $output);
return $output;
}
function check_command_file() {
echo "Try to compile... ";
$buildoutput = execute('cd ' . dirname(COMMAND) . ';make clean; NODEBUG=y make 2>&1', true);
if (!is_file(COMMAND)) {
echo 'error:\n';
echo $buildoutput;
exit;
}
else {
echo "ok.\n\n";
}
}
?>