Switched to HTML5

This commit is contained in:
2026-09-16 19:59:18 +02:00
parent b6f8fd3504
commit 0b8c5bee68
367 changed files with 10993 additions and 15796 deletions
+33
View File
@@ -0,0 +1,33 @@
import { TestCase } from "./framework/test_case.js";
import { groupDigits, compact, hours, improvements } from "../shared/text_format.js";
export class TextFormatTest extends TestCase {
test_group_digits() {
this.assertEqual(groupDigits(0), "0");
this.assertEqual(groupDigits(7), "7");
this.assertEqual(groupDigits(123), "123");
this.assertEqual(groupDigits(1234), "1 234");
this.assertEqual(groupDigits(1234567), "1 234 567");
this.assertEqual(groupDigits(-1234), "-1 234");
}
test_compact() {
this.assertEqual(compact(0), "0");
this.assertEqual(compact(7), "7");
this.assertEqual(compact(999), "999");
this.assertEqual(compact(1234), "1.23K");
this.assertEqual(compact(1234567), "1.23M");
this.assertEqual(compact(999950), "1M");
this.assertEqual(compact(-2500), "-2.5K");
}
test_hours() {
this.assertEqual(hours(0.5), "0.50 h");
this.assertEqual(hours(2.25), "2.3 h");
}
test_improvements() {
this.assertEqual(improvements([]), "None");
this.assertEqual(improvements(["Eiffel Tower", "Louvre"]), "Eiffel Tower, Louvre");
}
}