-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3463eb
commit 402e1bd
Showing
1 changed file
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(),''); | ||
}); |