Skip to content

Commit a86d918

Browse files
committed
add ci
1 parent 147db93 commit a86d918

2 files changed

Lines changed: 168 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macos-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Carp
20+
uses: carpentry-org/setup-carp@v1
21+
22+
- name: Run tests
23+
run: |
24+
set -euo pipefail
25+
carp -x tests/int16.carp
26+
carp -x tests/int32.carp
27+
carp -x tests/int64.carp
28+
carp -x tests/int8.carp
29+
carp -x tests/uint16.carp
30+
carp -x tests/uint32.carp
31+
carp -x tests/uint64.carp
32+
carp -x tests/uint8.carp

stdint.carp

Lines changed: 136 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,30 @@
2828
(register str (λ [Int8] String))
2929
(register copy (Fn [&Int8] Int8))
3030

31+
(defn zero [] (from-long 0l))
3132
(defn prn [a] (Int8.str a))
3233

3334
(register from-bytes (Fn [&(Array Byte)] (Array Int8)))
35+
(implements + Int8.+)
36+
(implements - Int8.-)
37+
(implements * Int8.*)
38+
(implements / Int8./)
39+
(implements < Int8.<)
40+
(implements > Int8.>)
41+
(implements = Int8.=)
42+
(implements copy Int8.copy)
43+
(implements zero Int8.zero)
44+
(implements bit-shift-left Int8.bit-shift-left)
45+
(implements bit-shift-right Int8.bit-shift-right)
46+
(implements bit-and Int8.bit-and)
47+
(implements bit-or Int8.bit-or)
48+
(implements bit-xor Int8.bit-xor)
49+
(implements bit-not Int8.bit-not)
3450
)
3551

3652
(defmodule Int8Extra
37-
(defn prn [a] (Int8.prn @a))
38-
(defn str [a] (Int8.str @a))
3953
(defn = [a b] (Int8.= @a @b))
54+
(implements = Int8Extra.=)
4055
)
4156

4257
(defmodule Int16
@@ -58,15 +73,30 @@
5873
(register str (λ [Int16] String))
5974
(register copy (Fn [&Int16] Int16))
6075

76+
(defn zero [] (from-long 0l))
6177
(defn prn [a] (Int16.str a))
6278

6379
(register from-bytes (Fn [&(Array Byte)] (Array Int16)))
80+
(implements + Int16.+)
81+
(implements - Int16.-)
82+
(implements * Int16.*)
83+
(implements / Int16./)
84+
(implements < Int16.<)
85+
(implements > Int16.>)
86+
(implements = Int16.=)
87+
(implements copy Int16.copy)
88+
(implements zero Int16.zero)
89+
(implements bit-shift-left Int16.bit-shift-left)
90+
(implements bit-shift-right Int16.bit-shift-right)
91+
(implements bit-and Int16.bit-and)
92+
(implements bit-or Int16.bit-or)
93+
(implements bit-xor Int16.bit-xor)
94+
(implements bit-not Int16.bit-not)
6495
)
6596

6697
(defmodule Int16Extra
67-
(defn prn [a] (Int16.prn @a))
68-
(defn str [a] (Int16.str @a))
6998
(defn = [a b] (Int16.= @a @b))
99+
(implements = Int16Extra.=)
70100
)
71101

72102
(defmodule Int32
@@ -88,15 +118,30 @@
88118
(register str (λ [Int32] String))
89119
(register copy (Fn [&Int32] Int32))
90120

121+
(defn zero [] (from-long 0l))
91122
(defn prn [a] (Int32.str a))
92123

93124
(register from-bytes (Fn [&(Array Byte)] (Array Int32)))
125+
(implements + Int32.+)
126+
(implements - Int32.-)
127+
(implements * Int32.*)
128+
(implements / Int32./)
129+
(implements < Int32.<)
130+
(implements > Int32.>)
131+
(implements = Int32.=)
132+
(implements copy Int32.copy)
133+
(implements zero Int32.zero)
134+
(implements bit-shift-left Int32.bit-shift-left)
135+
(implements bit-shift-right Int32.bit-shift-right)
136+
(implements bit-and Int32.bit-and)
137+
(implements bit-or Int32.bit-or)
138+
(implements bit-xor Int32.bit-xor)
139+
(implements bit-not Int32.bit-not)
94140
)
95141

96142
(defmodule Int32Extra
97-
(defn prn [a] (Int32.prn @a))
98-
(defn str [a] (Int32.str @a))
99143
(defn = [a b] (Int32.= @a @b))
144+
(implements = Int32Extra.=)
100145
)
101146

102147
(defmodule Int64
@@ -118,15 +163,30 @@
118163
(register str (λ [Int64] String))
119164
(register copy (Fn [&Int64] Int64))
120165

166+
(defn zero [] (from-long 0l))
121167
(defn prn [a] (Int64.str a))
122168

123169
(register from-bytes (Fn [&(Array Byte)] (Array Int64)))
170+
(implements + Int64.+)
171+
(implements - Int64.-)
172+
(implements * Int64.*)
173+
(implements / Int64./)
174+
(implements < Int64.<)
175+
(implements > Int64.>)
176+
(implements = Int64.=)
177+
(implements copy Int64.copy)
178+
(implements zero Int64.zero)
179+
(implements bit-shift-left Int64.bit-shift-left)
180+
(implements bit-shift-right Int64.bit-shift-right)
181+
(implements bit-and Int64.bit-and)
182+
(implements bit-or Int64.bit-or)
183+
(implements bit-xor Int64.bit-xor)
184+
(implements bit-not Int64.bit-not)
124185
)
125186

126187
(defmodule Int64Extra
127-
(defn prn [a] (Int64.prn @a))
128-
(defn str [a] (Int64.str @a))
129188
(defn = [a b] (Int64.= @a @b))
189+
(implements = Int64Extra.=)
130190
)
131191

132192
(defmodule Uint8
@@ -148,15 +208,30 @@
148208
(register str (λ [Uint8] String))
149209
(register copy (Fn [&Uint8] Uint8))
150210

211+
(defn zero [] (from-long 0l))
151212
(defn prn [a] (Uint8.str a))
152213

153214
(register from-bytes (Fn [&(Array Byte)] (Array Uint8)))
215+
(implements + Uint8.+)
216+
(implements - Uint8.-)
217+
(implements * Uint8.*)
218+
(implements / Uint8./)
219+
(implements < Uint8.<)
220+
(implements > Uint8.>)
221+
(implements = Uint8.=)
222+
(implements copy Uint8.copy)
223+
(implements zero Uint8.zero)
224+
(implements bit-shift-left Uint8.bit-shift-left)
225+
(implements bit-shift-right Uint8.bit-shift-right)
226+
(implements bit-and Uint8.bit-and)
227+
(implements bit-or Uint8.bit-or)
228+
(implements bit-xor Uint8.bit-xor)
229+
(implements bit-not Uint8.bit-not)
154230
)
155231

156232
(defmodule Uint8Extra
157-
(defn prn [a] (Uint8.prn @a))
158-
(defn str [a] (Uint8.str @a))
159233
(defn = [a b] (Uint8.= @a @b))
234+
(implements = Uint8Extra.=)
160235
)
161236

162237
(defmodule Uint16
@@ -178,15 +253,30 @@
178253
(register str (λ [Uint16] String))
179254
(register copy (Fn [&Uint16] Uint16))
180255

256+
(defn zero [] (from-long 0l))
181257
(defn prn [a] (Uint16.str a))
182258

183259
(register from-bytes (Fn [&(Array Byte)] (Array Uint16)))
260+
(implements + Uint16.+)
261+
(implements - Uint16.-)
262+
(implements * Uint16.*)
263+
(implements / Uint16./)
264+
(implements < Uint16.<)
265+
(implements > Uint16.>)
266+
(implements = Uint16.=)
267+
(implements copy Uint16.copy)
268+
(implements zero Uint16.zero)
269+
(implements bit-shift-left Uint16.bit-shift-left)
270+
(implements bit-shift-right Uint16.bit-shift-right)
271+
(implements bit-and Uint16.bit-and)
272+
(implements bit-or Uint16.bit-or)
273+
(implements bit-xor Uint16.bit-xor)
274+
(implements bit-not Uint16.bit-not)
184275
)
185276

186277
(defmodule Uint16Extra
187-
(defn prn [a] (Uint16.prn @a))
188-
(defn str [a] (Uint16.str @a))
189278
(defn = [a b] (Uint16.= @a @b))
279+
(implements = Uint16Extra.=)
190280
)
191281

192282
(defmodule Uint32
@@ -208,15 +298,30 @@
208298
(register str (λ [Uint32] String))
209299
(register copy (Fn [&Uint32] Uint32))
210300

301+
(defn zero [] (from-long 0l))
211302
(defn prn [a] (Uint32.str a))
212303

213304
(register from-bytes (Fn [&(Array Byte)] (Array Uint32)))
305+
(implements + Uint32.+)
306+
(implements - Uint32.-)
307+
(implements * Uint32.*)
308+
(implements / Uint32./)
309+
(implements < Uint32.<)
310+
(implements > Uint32.>)
311+
(implements = Uint32.=)
312+
(implements copy Uint32.copy)
313+
(implements zero Uint32.zero)
314+
(implements bit-shift-left Uint32.bit-shift-left)
315+
(implements bit-shift-right Uint32.bit-shift-right)
316+
(implements bit-and Uint32.bit-and)
317+
(implements bit-or Uint32.bit-or)
318+
(implements bit-xor Uint32.bit-xor)
319+
(implements bit-not Uint32.bit-not)
214320
)
215321

216322
(defmodule Uint32Extra
217-
(defn prn [a] (Uint32.prn @a))
218-
(defn str [a] (Uint32.str @a))
219323
(defn = [a b] (Uint32.= @a @b))
324+
(implements = Uint32Extra.=)
220325
)
221326

222327
(defmodule Uint64
@@ -238,13 +343,28 @@
238343
(register str (λ [Uint64] String))
239344
(register copy (Fn [&Uint64] Uint64))
240345

346+
(defn zero [] (from-long 0l))
241347
(defn prn [a] (Uint64.str a))
242348

243349
(register from-bytes (Fn [&(Array Byte)] (Array Uint64)))
350+
(implements + Uint64.+)
351+
(implements - Uint64.-)
352+
(implements * Uint64.*)
353+
(implements / Uint64./)
354+
(implements < Uint64.<)
355+
(implements > Uint64.>)
356+
(implements = Uint64.=)
357+
(implements copy Uint64.copy)
358+
(implements zero Uint64.zero)
359+
(implements bit-shift-left Uint64.bit-shift-left)
360+
(implements bit-shift-right Uint64.bit-shift-right)
361+
(implements bit-and Uint64.bit-and)
362+
(implements bit-or Uint64.bit-or)
363+
(implements bit-xor Uint64.bit-xor)
364+
(implements bit-not Uint64.bit-not)
244365
)
245366

246367
(defmodule Uint64Extra
247-
(defn prn [a] (Uint64.prn @a))
248-
(defn str [a] (Uint64.str @a))
249368
(defn = [a b] (Uint64.= @a @b))
369+
(implements = Uint64Extra.=)
250370
)

0 commit comments

Comments
 (0)