Hong-Phuc Bui
2025-01-16 2889de7f0c2d587a17fbd322af57c29e84238620
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import test from "ava";
import * as Study from "../src/study.js";
 
test( "calculate homework time for lecture", t => {
    const SWS = 2;
    const ECTS = 5;
    const EXPECTED = 7;
    const epsilon = 0.00001;
    const homeworkTime = Study.calculateHomeworkTime(ECTS, SWS);
    const diff = Math.abs((EXPECTED-homeworkTime)/EXPECTED );
    t.truthy(diff < epsilon );
});
 
test( "calculate homework time for lecture in corona phase", t => {
    const SWS = 2;
    const ECTS = 5;
    const EXPECTED = 8.54;
    const lectureWeeks = 13;
    const epsilon = 0.1;
    const homeworkTime = Study.calculateHomeworkTime(ECTS, SWS, lectureWeeks);
    const diff = Math.abs((EXPECTED-homeworkTime)/EXPECTED );
    t.truthy(diff < epsilon );
});