Skip to content

Commit

Permalink
//
Browse files Browse the repository at this point in the history
  • Loading branch information
HaQmUser committed Nov 5, 2024
1 parent 417da10 commit 3ed5824
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 6 deletions.
6 changes: 6 additions & 0 deletions rpgsaga/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions rpgsaga/saga/src/Rabbit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Rabbit } from './RabbitClass';

const rabbitOne = new Rabbit('Vitalik',3,'Brown','Male')

Check failure on line 3 in rpgsaga/saga/src/Rabbit.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Replace `3,'Brown','Male')` with `·3,·'Brown',·'Male');`
console.log(rabbitOne)

Check failure on line 4 in rpgsaga/saga/src/Rabbit.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Insert `;`
const rabbitTwo = new Rabbit('LuiVitonovich',4,'Black','Female')

Check failure on line 5 in rpgsaga/saga/src/Rabbit.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Replace `4,'Black','Female')` with `·4,·'Black',·'Female');`
console.log(rabbitTwo)

Check failure on line 6 in rpgsaga/saga/src/Rabbit.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Insert `;⏎`
46 changes: 46 additions & 0 deletions rpgsaga/saga/src/RabbitClass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export class Rabbit {
private _name: string;

Check failure on line 2 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Delete `··`
private _age: number;

Check failure on line 3 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Replace `····` with `··`
private _color: string;

Check failure on line 4 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Replace `····` with `··`
private _gender: string;

Check failure on line 5 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Delete `··`
constructor(name: string, age: number, gender: string, color: string) {

Check failure on line 6 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Delete `··`
this._name = name;

Check failure on line 7 in rpgsaga/saga/src/RabbitClass.ts

View workflow job for this annotation

GitHub Actions / saga-ci

Delete `··`
this._age = age;
this._color = color;
this._gender = gender;
}

public set age(age: number) {
if (age < 0) {
throw new Error('Invalid age');
}
this._age = age;
}
public set name(name: string) {
this._name = name;
}
public set color(color: string) {
this.color = color;
}
public set gender(gender: string) {
if (gender.toLowerCase() == 'male'){
this._gender = 'Male';
} else if (gender.toLowerCase() == 'female'){
this._gender = 'Female'
} else {
throw new Error('Invalid gender')
}
}
public get age() {
return this._age;
}
public get name() {
return this._name;
}
public get gender() {
return this._gender;
}
public get color() {
return this._color;
}
}
22 changes: 16 additions & 6 deletions rpgsaga/saga/tests/mathematics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@ import { formula, taskA, taskB } from '../src/mathematics';

describe('formula', () => {
test('should return right result', () => {
const result = formula(0.25);
expect(result).toBeCloseTo(0.168);
expect(formula(0.25)).toBeCloseTo(0.168);
});

test('This Arccos doesnt excist', () => {
const result = formula(2,2);
expect(result).toBeNaN();
expect(formula(2.2)).toBeNaN();
});

test('should handle division by zero in denominator', () => {
const result = formula(1, 2, 3);
const result = formula(1);
expect(result).toBeDefined();
});
});
});

describe('TaskA',()=> {
test('should return right size',()=>{
expect(taskA(0.7,2.2,0.3)).toHaveLength(5);
})
})

describe('TaskB',()=> {
test('should return right size',()=>{
expect(taskB([0.25, 0.36, 0.56, 0.94, 1.28])).toHaveLength(5);
})
})

0 comments on commit 3ed5824

Please sign in to comment.