/*開始時刻やタイミングが書かれた文字列*/\r
string: "",\r
\r
+ /*イベントやindefinteで未解決かどうか*/\r
+ isResolved: false,\r
+\r
/*trim メソッド\r
* 文字列中の空白を除去*/\r
trim: function() {\r
plusminus = _float = sec = min = h = void 0;\r
return s;\r
\r
+ /*00:00:0と00:0と、0sなどの文字列をミリ秒へ変換*/\r
function sec() {\r
return ( 1000*( _float(str.match(/[\d.]+s$/) || "0") || _float(str.match(/[\d.]+$/) || "0") ) );\r
};\r
event: str\r
};\r
}\r
+ },\r
+ \r
+ /*parse メソッド\r
+ * stringプロパティを解析して、時刻を算出し、結果を$frame::beginプロパティに出力*/\r
+ parse: function() {\r
+ this.begin = 0;\r
+ var str = this.trim(),\r
+ plusminus = str.search(/[\+\-]/),\r
+ event = "";\r
+ if (plusminus > 0) {\r
+ /*Event-Value +/- Clock-Value の場合*/\r
+ this.begin = this.offset( str.slice(plusminus) );\r
+ event = this.event(str);\r
+ } else if ( /[^\+\-\d]/.test(str.charAt(0)) ) {\r
+ /*Event-Valuen のみの場合*/\r
+ event = this.event(str);\r
+ } else {\r
+ /*+/- Clock-Value のみの場合*/\r
+ this.begin = this.offset( str );\r
+ /*イベントもindefiniteもないので、解決済みと考える*/\r
+ this.isResolved = true;\r
+ }\r
+ return this;\r
}\r
} );\r
} );\r
/*境界条件を調べておく (limit value analysis)*/\r
it("should be this for the value (limit value analysis)", function() {\r
expect(begin.string).toBe("");\r
+ expect(begin.isResolved).toBeFalsy();\r
} );\r
/*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
it("should be this for the value (the valid partion)", function() {\r
expect(evt.event).toBe("");\r
evt = begin.event("id.");\r
expect(evt.id).toBe("");\r
- expect(evt.event).toBe(""); } );\r
+ expect(evt.event).toBe("");\r
+ } );\r
+ } );\r
+ \r
+ describe("An parse method in $begin object", function() {\r
+ beforeEach( function() {\r
+ begin.string = "";\r
+ } );\r
+ /*境界条件を調べておく (limit value analysis)*/\r
+ it("should be this for the value (limit value analysis)", function() {\r
+ expect(begin.parse().begin).toEqual(0);\r
+ begin.string="+0";\r
+ expect(begin.parse().begin).toEqual(0);\r
+ begin.string = "+1";\r
+ expect(begin.parse().begin).toEqual(1000);\r
+ begin.string = " ";\r
+ expect(begin.parse().begin).toEqual(0);\r
+ begin.string = "1";\r
+ expect(begin.parse().begin).toEqual(1000);\r
+ begin.string = "+1ms";\r
+ expect(begin.parse().begin).toEqual(1);\r
+ begin.string = "-1ms";\r
+ expect(begin.parse().begin).toEqual(-1);\r
+ } );\r
+ /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
+ it("should be this for the value (the valid partion)", function() {\r
+ begin.string = " 1 0 0 m s";\r
+ expect(begin.parse().begin).toEqual(100);\r
+ begin.string = "ms";\r
+ begin.isResolved = false;\r
+ expect(begin.parse().begin).toEqual(0);\r
+ expect(begin.isResolved).toBeFalsy();\r
+ } );\r
+ /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
+ it("should be this for the value (the invalid partion)", function() {\r
+ \r
+ } );\r
} );\r
} );\r
} )\r