Hong-Phuc Bui
2024-10-16 f8613c9ce2bd4b74b11727d2eae204f49151bcba
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;
    let homeworkTime = Study.calculateHomeworkTime(ECTS, SWS);
    let diff = Math.abs((EXPECTED-homeworkTime)/EXPECTED ); // (|expected -hw|)/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;
    let homeworkTime = Study.calculateHomeworkTime(ECTS, SWS, lectureWeeks);
    let diff = Math.abs((EXPECTED-homeworkTime)/EXPECTED ); // (|expected -hw|)/expected
    t.truthy(diff < epsilon );
});