return s;\r
\r
function ms() {\r
- var deg = str.match(/[\d.]+ms$/) || "0";\r
- return ( parseFloat(deg) );\r
+ return parseFloat( str.match(/[\d.]+ms$/) || "0");\r
};\r
function sec() {\r
var deg = str.match(/:[\d.]+$/) || "0",\r
};\r
function h() {\r
var deg = str.match(/\d+:\d\d:/) || "0",\r
- de = str.match(/\d+h$/) || "0";\r
+ de = str.match(/[\d.]+h$/) || "0";\r
return ( 3600000*( parseFloat(deg) || parseFloat(de) ) );\r
};\r
},\r
expect(begin.offset("-121s")).toEqual(-121 * 1000);\r
expect(begin.offset("1.25s")).toEqual(1.25 * 1000);\r
expect(begin.offset("-0.20s")).toEqual(-0.20 * 1000);\r
+ expect(begin.offset(".20s")).toEqual(0.20 * 1000);\r
\r
- expect(begin.offset("+0min")).toEqual(0);\r
- expect(begin.offset("-0min")).toEqual(0);\r
- expect(begin.offset("1min")).toEqual(60000);\r
- expect(begin.offset("-1min")).toEqual(-60000);\r
+ expect(begin.offset("+100min")).toEqual(100 * 60000);\r
+ expect(begin.offset("-121min")).toEqual(-121 * 60000);\r
+ expect(begin.offset("1.25min")).toEqual(1.25 * 60000);\r
+ expect(begin.offset("-0.20min")).toEqual(-0.20 * 60000);\r
+ expect(begin.offset(".20min")).toEqual(0.20 * 60000);\r
\r
- expect(begin.offset("+0h")).toEqual(0);\r
- expect(begin.offset("-0h")).toEqual(0);\r
- expect(begin.offset("1h")).toEqual(60*60*1000);\r
- expect(begin.offset("-1h")).toEqual(-3600000);\r
+ expect(begin.offset("+100h")).toEqual(100 * 3600000);\r
+ expect(begin.offset("-121h")).toEqual(-121 * 3600000);\r
+ expect(begin.offset("1.25h")).toEqual(1.25 * 3600000);\r
+ expect(begin.offset("-0.20h")).toEqual(-0.20 * 3600000);\r
+ expect(begin.offset(".20h")).toEqual(0.20 * 3600000);\r
} );\r
/*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
it("should be this for the value (the invalid partion)", function() {\r
- begin.string = " h o g e ";\r
+ begin.string = " h o g 1e ";\r
expect(begin.offset(begin.trim())).toEqual(0);\r
expect(begin.offset("ms")).toEqual(0);\r
+ expect(begin.offset(".s")).toEqual(0);\r
} );\r
} );\r
\r