Created
October 29, 2016 15:40
-
-
Save awn-git/ad7ddb80f7044a31ea067d819eb7931c to your computer and use it in GitHub Desktop.
Op2oolsをテストするためのツール
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ////////////////////////////////////////////////////////////////////////// | |
| // | |
| //@title Op2oolsTester.js | |
| //@description Op2oolsをテストするためのツール | |
| //@include http://*.open2ch.net/ | |
| //@private | |
| // | |
| //作った人: Awn(@Awn_tw) | |
| // | |
| //改定履歴 | |
| //-20161029(ver 1.0.0): 新規作成? | |
| // | |
| //諸注意 | |
| //-ご利用は自己責任でお願いします。 | |
| //-スクリプトは予告なく修正または廃止されることがあります。 | |
| //-コンソールでしか動かない、と思います。 | |
| //-悪用は厳禁です。 | |
| //-改造改良改悪はご自由にどうぞ。 | |
| // | |
| ////////////////////////////////////////////////////////////////////////// | |
| /********************************************************/ | |
| /*[凡例] | |
| /********************************************************/ | |
| /*--------------------------------*/ | |
| //大見出し | |
| /*--------------------------------*/ | |
| /*----------------*/ | |
| //中見出し | |
| /*----------------*/ | |
| /* 一行見出し */ | |
| //小見出し | |
| //TODO: | |
| /********************************************************/ | |
| (function(){ | |
| /*--------------------------------*/ | |
| //初期化 | |
| /*--------------------------------*/ | |
| try{Op2ools}catch(e){ | |
| console.warn("SureAnalysis: @require Op2ools"); | |
| console.warn("SureAnalysis: Run Op2ools before this script!"); | |
| return undefined; | |
| } | |
| /*--------------------------------*/ | |
| //テスト関数 | |
| /*--------------------------------*/ | |
| var lastnum = Op2ools.getLastResNum(); | |
| var _f = [ | |
| function(n){return ["入力",n];}, | |
| function(){return ["総レス数",lastnum];}, | |
| function(n){return ["レス内容",Op2ools.getRes(n)];}, | |
| function(n){return ["名前欄",Op2ools.getResName(n)];}, | |
| function(n){return ["時間",Op2ools.getResTime(n)];}, | |
| function(n){return ["ID",Op2ools.getResID(n)];}, | |
| function(n){return ["スレ主",Op2ools.isSurenusi(n)];} | |
| ]; | |
| var f = function(t){return _f.map(function(elm){return elm(t);});}; | |
| /*--------------------------------*/ | |
| //テストケース | |
| /*--------------------------------*/ | |
| console.log("----------------------------"); | |
| console.time("実行時間"); | |
| console.table(f()); | |
| console.table(f("a test")); | |
| console.table(f(-1)); | |
| console.table(f(0)); | |
| console.table(f(1)); | |
| console.table(f(499)); | |
| console.table(f(500)); | |
| console.table(f(501)); | |
| console.table(f(502)); | |
| console.table(f(503)); | |
| console.table(f(lastnum-1)); | |
| console.table(f(lastnum)); | |
| console.table(f(lastnum+1)); | |
| console.table(f(999)); | |
| console.table(f(1000)); | |
| console.table(f(1001)); | |
| console.table(f(1002)); | |
| console.table(f(1003)); | |
| console.table(f(1004)); | |
| console.table(f(1005)); | |
| console.table(f(1006)); | |
| console.table(f(1007)); | |
| console.table(f(19999)); | |
| console.timeEnd("実行時間"); | |
| console.log("Op2ools: " + Op2ools.VERSION); | |
| console.log("----------------------------"); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment