Skip to content

Commit 5b1e41a

Browse files
authored
Merge branch '313551150' into lab6
2 parents 139f54a + f975718 commit 5b1e41a

File tree

2 files changed

+14
-47
lines changed

2 files changed

+14
-47
lines changed

lab1/main_test.js

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,21 @@ const assert = require('assert');
33
const { MyClass, Student } = require('./main');
44

55
test("Test MyClass's addStudent", () => {
6-
const myClass = new MyClass();
7-
const student = new Student();
8-
9-
// Valid student case
10-
const studentId = myClass.addStudent(student);
11-
assert.strictEqual(studentId, 0);
12-
13-
// Invalid input case
14-
const invalidId = myClass.addStudent({});
15-
assert.strictEqual(invalidId, -1);
6+
// TODO
7+
throw new Error("Test not implemented");
168
});
179

1810
test("Test MyClass's getStudentById", () => {
19-
const myClass = new MyClass();
20-
const student = new Student();
21-
student.setName("John");
22-
23-
const studentId = myClass.addStudent(student);
24-
25-
// Valid retrieval
26-
const retrievedStudent = myClass.getStudentById(studentId);
27-
assert.ok(retrievedStudent instanceof Student);
28-
assert.strictEqual(retrievedStudent.getName(), "John");
29-
30-
// Invalid ID cases
31-
assert.strictEqual(myClass.getStudentById(-1), null);
32-
assert.strictEqual(myClass.getStudentById(101), null);
11+
// TODO
12+
throw new Error("Test not implemented");
3313
});
3414

35-
3615
test("Test Student's setName", () => {
37-
const student = new Student();
38-
39-
// Valid name setting
40-
student.setName("Jane");
41-
assert.strictEqual(student.getName(), "Jane");
42-
43-
// Invalid input cases
44-
student.setName(123);
45-
assert.strictEqual(student.getName(), "Jane"); // Should not change
46-
47-
student.setName(null);
48-
assert.strictEqual(student.getName(), "Jane"); // Should not change
16+
// TODO
17+
throw new Error("Test not implemented");
4918
});
5019

5120
test("Test Student's getName", () => {
52-
const student = new Student();
53-
54-
// Default value case
55-
assert.strictEqual(student.getName(), '');
56-
57-
// After setting a valid name
58-
student.setName("Alice");
59-
assert.strictEqual(student.getName(), "Alice");
21+
// TODO
22+
throw new Error("Test not implemented");
6023
});

lab5/antiasan.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <string.h>
22

3-
void antiasan(unsigned long addr)
4-
{
53

4+
extern char gS[];
5+
extern char gBadBuf[];
6+
extern void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
7+
void antiasan(unsigned long addr) {
8+
__asan_unpoison_memory_region(gS, 0xa7);
9+
__asan_unpoison_memory_region(gBadBuf, 0xa7);
610
}

0 commit comments

Comments
 (0)