?? tests.csp
字號:
package tests;
class tclass_base
{
var value;
function tclass_base(v) { value = v; }
function toString() { return string(value); }
}
class tclass: tclass_base
{
function tclass(v) { tclass_base(v); }
}
function basics_test() {
var v = new tclass(4);
var v_base = new tclass_base(4);
if (!(v instanceof tclass)) throw "instanceof 1";
if (!(v instanceof tclass_base)) throw "instanceof 2";
if (v_base instanceof tclass) throw "instanceof 3";
print("basics test passed! \n");
}
function string_test()
{
var v = new tclass(4);
if ( "1" + 2 + "3" != "123" ) throw "default toString in assignmet";
if ( "1" + 2 + "3" + v != "1234" ) throw "user defined toString in assignmet";
var s = new string("0123456789");
if( s[3] != '3' ) throw "item";
// substr test
if ( "0123456789".substr(2,3) != "234" ) throw "substr 1";
if ( "0123456789".substr(2,10) != "23456789" ) throw "substr 2";
if ( "0123456789".substr(-2,8) != "01234567" ) throw "substr 3";
if ( "0123456789".substr(2,-8) != "" ) throw "substr 4";
// slice test
if ( "0123456789".slice(2,6) != "2345" ) throw "slice 1";
if ( "0123456789".slice(2,-2) != "234567" ) throw "slice 2";
// case tests
if ( "Hello World".to_upper() != "HELLO WORLD" ) throw "to_upper";
if ( "Hello World".to_lower() != "hello world" ) throw "to_lover";
// case test /russian/
//locale("Russian");
// if ( "橡椏弳 惕
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -