Skip to content

Commit 993f03a

Browse files
cleanup: till lecture 3 (#11)
* fix: course1 * fix: course3 * fix: header pages
1 parent 9958160 commit 993f03a

File tree

6 files changed

+114
-274
lines changed

6 files changed

+114
-274
lines changed

course1/course_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ It is recommended to adopt a **test-driven development** (TDD) workflow, namely,
131131

132132
> Given the two integers `num_bottles` and `num_exchange`, return _the **maximum** number of water bottles you can drink_.
133133
134-
```moonbit
134+
```moonbit no-check
135135
fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
136136
abort("To be done")
137137
}

course1/lec1.mbt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
1111
consume(num_bottles, 0)
1212
}
1313

14-
fn init {
15-
assert(num_water_bottles(9, 3) == 13)
16-
assert(num_water_bottles(15, 4) == 19)
17-
}
18-
19-
fn assert(test: Bool) {
20-
if test.not() {
21-
abort("Test failed")
22-
}
14+
test {
15+
@assertion.assert_eq(num_water_bottles(9, 3), 13)? // 9 + 3 + 1 = 13
16+
@assertion.assert_eq(num_water_bottles(15, 4), 19)?
2317
}

course1/lec1.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ style: |
99
}
1010
---
1111

12-
![bg cover](../pics/course1_front.png)
12+
# 现代编程思想
13+
14+
## 课程介绍 & 程序设计
15+
16+
### 月兔公开课课程组
1317

1418
---
1519

@@ -106,7 +110,7 @@ $$
106110

107111
> 给你两个整数 `num_bottles``num_exchange` ,返回你**最多**可以喝到多少瓶水。
108112
109-
```moonbit
113+
```moonbit no-check
110114
fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
111115
abort("To be done")
112116
}
@@ -117,15 +121,9 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
117121
# 步骤三:写测试案例
118122

119123
```moonbit
120-
fn init {
121-
assert(num_water_bottles(9, 3) == 13) // 9 + 3 + 1 = 13
122-
assert(num_water_bottles(15, 4) == 19)
123-
}
124-
125-
fn assert(test: Bool) {
126-
if test.not() {
127-
abort("Test failed")
128-
}
124+
test {
125+
@assertion.assert_eq(num_water_bottles(9, 3), 13)? // 9 + 3 + 1 = 13
126+
@assertion.assert_eq(num_water_bottles(15, 4), 19)?
129127
}
130128
```
131129

course2/lec2.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ paginate: true
55
backgroundImage: url('../pics/background_moonbit.png')
66
---
77

8-
![bg cover](../pics/course2_front.png)
8+
# 现代编程思想
9+
10+
## 月兔开发与月兔中的表达式
11+
12+
### 月兔公开课课程组
913

1014
---
1115

0 commit comments

Comments
 (0)