},\r
\r
/*計算モード。advanceメソッドで時間の圧縮率を求めるのに使う*/\r
- calcMode: base("$calcMode"),\r
+ calc: base("$calcMode"),\r
\r
/*$toオブジェクトにこのオブジェクトを適用させる関数*/\r
call: function() {\r
if (!this.string || !this.from) {\r
return "";\r
}\r
+ /*時間の圧縮率をもとに変換 ($calcMode オブジェクトを参照)*/\r
+ t = this.calc(t);\r
var str = "",\r
numList = this.numList,\r
strList = this.strList,\r
/*keyTimesの区間\r
* たとえば、"0, 0.5, 0.7, 1"の場合、時間の区間はそれぞれ、0.5 (=0.5-0) 0.2 (=0.7-0.5) 0.3 (=1-0.7)である\r
* このうち、どれか一つが値として入力される*/\r
- keyTime: 0,\r
+ keyTime: 1,\r
\r
/*keySpline属性の値を設定*/\r
keySpline: null,\r
} )\r
} );\r
describe("A $calcMode object", function() {\r
- var calc = base("$calcMode");\r
+ var calc = base("$calcMode"),\r
+ from = base("$from");\r
beforeEach( function() {\r
calc = calc.up();\r
+ from = from.up();\r
+ from.up("$to");\r
} );\r
/*境界条件を調べておく (limit value analysis)*/\r
it("should be this for the value (limit value analysis)", function() {\r
expect(calc.mode).toBe("linear");\r
- expect(calc.keyTime).toEqual(0);\r
+ expect(calc.keyTime).toEqual(1);\r
expect(calc.keySpline).toBeNull();\r
\r
expect(calc.call()(0)).toEqual(0);\r
- expect(calc.keyTime).toBe(0);\r
- expect(calc.call()(1)).toEqual(0);\r
+ expect(calc.keyTime).toBe(1);\r
+ expect(calc.call()(1)).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
calc.keyTime = 0.5;\r
expect(calc.call()(0.2)).toEqual(0.4);\r
+ expect(calc.call()(0.3)).toEqual(0.6);\r
+ /*もう一度確かめる*/\r
+ expect(calc.call()(0.2)).toEqual(0.4);\r
+ \r
+ from.$to.calc = from.calc.up();\r
+ from.$to.calc.keyTime = 0.2;\r
+ from.string = "0s";\r
+ from.$to.string = "1s";\r
+ from.$to.degit = 1;\r
+ from.$to.call();\r
+ from.call();\r
+ expect(from.$to.advance(0.1)).toBe("0.5s");\r
} );\r
/*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
it("should be this for the value (the invalid partion)", function() {\r