diff --git a/index.html b/index.html index 1a3fe67..22dae93 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,8 @@ - + @@ -26,12 +27,14 @@ -
-

引体向上计数器

-

模型加载中...

-
- - +
+

引体向上计数器

+

模型加载中...

+
+ + \ No newline at end of file diff --git a/package.json b/package.json index 89a2698..5b8dda6 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "scripts": { - "test": "jest" + "test": "ava --verbose" }, "devDependencies": { - "@jest/globals": "^29.5.0" + "ava": "^5.3.1" } -} +} \ No newline at end of file diff --git a/sketch.js b/sketch.js index a308cd6..019d7ec 100644 --- a/sketch.js +++ b/sketch.js @@ -310,6 +310,7 @@ function calculateKeypointDistance(keypoint1, keypoint2) { function calculateDistance(keypoint1, keypoint2) { return dist(keypoint1.x, keypoint1.y, keypoint2.x, keypoint2.y); } + // 计算三个关键点所形成的角度 function calculateAngle(pointA, pointB, pointC) { const AB = distanceCalculator.calculate(pointA, pointB); @@ -364,3 +365,4 @@ function updatePullUpCounter() { pullUpDone = false; } } + diff --git a/test/1.test.js b/test/1.test.js deleted file mode 100644 index 24258cf..0000000 --- a/test/1.test.js +++ /dev/null @@ -1,19 +0,0 @@ -// 导入被测试的函数 -// const { calculateKeypointDistance } = require('../sketch'); -import { calculateKeypointDistance } from '/sketch.js'; -// 编写测试用例 -describe('calculateKeypointDistance', () => { - test('should calculate distance between two keypoints correctly', () => { - // 模拟输入数据 - let keypoint1 = { position: { x: 1, y: 0 } }; - let keypoint2 = { position: { x: 2, y: 0 } }; - - // 调用被测试的函数 - const distance = calculateKeypointDistance(keypoint1, keypoint2); - console.log(distance); - - - // 断言期望的结果 - expect(distance).toBe(1.0); // 假设期望的距离为5 - }); -});