Skip to content

Commit

Permalink
Merge branch '310552064' into lab3
Browse files Browse the repository at this point in the history
  • Loading branch information
veture7275 authored Mar 18, 2024
2 parents a29572c + 115bc5a commit f9be20f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lab1/main_test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
const test = require('node:test');
const assert = require('assert');
const { MyClass, Student } = require('./main');
myclass = new MyClass();
student = new Student();
student.setName('John');

test("Test MyClass's addStudent", () => {
// TODO
throw new Error("Test not implemented");
assert.strictEqual(myclass.addStudent(1), -1);
assert.strictEqual(myclass.addStudent(student), 0);
});

test("Test MyClass's getStudentById", () => {
// TODO
throw new Error("Test not implemented");
myclass.addStudent(student);
assert.strictEqual(myclass.getStudentById(0),student);
assert.strictEqual(myclass.getStudentById(-1),null);
});

test("Test Student's setName", () => {
// TODO
throw new Error("Test not implemented");
assert.strictEqual(student.name,'John');
myclass.getStudentById(0).setName(12);
assert.strictEqual(myclass.getStudentById(0).getName(),'John');
});

test("Test Student's getName", () => {
// TODO
throw new Error("Test not implemented");
});
assert.strictEqual(myclass.getStudentById(0).getName(),student.name);
student2 = new Student();
myclass.addStudent(student2);
assert.strictEqual(myclass.getStudentById(2).getName(),'');
});
1 change: 1 addition & 0 deletions lab3/main_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const {describe, it} = require('node:test');
const assert = require('assert');
const { Calculator } = require('./main');

const test = require('node:test');
// TODO: write your tests here
test("Calculator's exp",()=>{
Expand Down

0 comments on commit f9be20f

Please sign in to comment.