jest-test-lineage-reporter 2.0.2 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ // This file contains functions with weak tests that will allow mutations to survive
2
+
3
+ export function simpleAdd(a: number, b: number): number {
4
+ return a + b;
5
+ }
6
+
7
+ export function complexLogic(x: number, y: number): number {
8
+ if (x > 10) {
9
+ return x * 2;
10
+ } else if (x < 0) {
11
+ return 0;
12
+ } else {
13
+ return x + y;
14
+ }
15
+ }
16
+
17
+ export function boundaryCheck(value: number): string {
18
+ if (value >= 100) {
19
+ return "high";
20
+ } else if (value <= 0) {
21
+ return "low";
22
+ } else {
23
+ return "medium";
24
+ }
25
+ }
26
+
27
+ export function logicalOperations(a: boolean, b: boolean): boolean {
28
+ if (a && b) {
29
+ return true;
30
+ } else if (a || b) {
31
+ return !a;
32
+ } else {
33
+ return false;
34
+ }
35
+ }
36
+
37
+ export function mathOperations(x: number): number {
38
+ const squared = x * x;
39
+ const doubled = x * 2;
40
+ const halved = x / 2;
41
+ return squared + doubled - halved;
42
+ }
43
+
44
+ export function stringOperations(str: string): string {
45
+ if (str.length > 5) {
46
+ return str.toUpperCase();
47
+ } else if (str.length === 0) {
48
+ return "empty";
49
+ } else {
50
+ return str.toLowerCase();
51
+ }
52
+ }
53
+
54
+ export function incrementOperations(x: number): number {
55
+ if (x > 10) {
56
+ return ++x;
57
+ } else if (x > 15) {
58
+ return --x;
59
+ } else {
60
+ return x;
61
+ }
62
+ }
63
+
64
+ export function subtleBugFunction(x: number, y: number): number {
65
+ if (x === 0) {
66
+ return 1;
67
+ } else if (x > 0) {
68
+ return x + y;
69
+ } else {
70
+ return x - y;
71
+ }
72
+ }
73
+
74
+ export function reallyWeakFunction(a: number, b: number): number {
75
+ const result = a * b;
76
+ if (result > 100) {
77
+ return result + 10;
78
+ } else {
79
+ return result - 5;
80
+ }
81
+ }
82
+
83
+ export function guaranteedSurvivedMutations(x: number): number {
84
+ if (x === 5) {
85
+ return 42;
86
+ } else if (x > 10) {
87
+ return x * 2;
88
+ } else {
89
+ return x + 1;
90
+ }
91
+ }