Skip to content

Commit

Permalink
单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
NormanMises committed Jun 29, 2023
1 parent 0f4c62c commit 5e34a1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 29 deletions.
17 changes: 10 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<!-- Bootstrap JS 和 jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
Expand All @@ -26,12 +27,14 @@
</head>

<body>
<div class="container">
<h1 class="text-center">引体向上计数器</h1>
<p id='status' class="text-center">模型加载中...</p>
</div>
<script src="sketch.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<div class="container">
<h1 class="text-center">引体向上计数器</h1>
<p id='status' class="text-center">模型加载中...</p>
</div>
<script src="sketch.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script>
</body>

</html>
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"test": "jest"
"test": "ava --verbose"
},
"devDependencies": {
"@jest/globals": "^29.5.0"
"ava": "^5.3.1"
}
}
}
2 changes: 2 additions & 0 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -364,3 +365,4 @@ function updatePullUpCounter() {
pullUpDone = false;
}
}

19 changes: 0 additions & 19 deletions test/1.test.js

This file was deleted.

0 comments on commit 5e34a1d

Please sign in to comment.