-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_vibesafe.py
More file actions
58 lines (48 loc) · 947 Bytes
/
test_vibesafe.py
File metadata and controls
58 lines (48 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
Test specs for demonstrating vibesafe functionality.
"""
from vibesafe import VibeCoded, vibesafe
@vibesafe.func
def multiply(a: int, b: int) -> int:
"""
Multiply two integers.
>>> multiply(2, 3)
6
>>> multiply(5, 7)
35
>>> multiply(-3, 4)
-12
>>> multiply(0, 10)
0
"""
raise VibeCoded()
@vibesafe.func
def factorial(n: int) -> int:
"""
Calculate the factorial of a non-negative integer.
>>> factorial(0)
1
>>> factorial(1)
1
>>> factorial(5)
120
>>> factorial(7)
5040
"""
if n < 0:
raise ValueError("n must be non-negative")
raise VibeCoded()
@vibesafe.func
def reverse_string(text: str) -> str:
"""
Reverse a string.
>>> reverse_string("hello")
'olleh'
>>> reverse_string("Python")
'nohtyP'
>>> reverse_string("12345")
'54321'
>>> reverse_string("")
''
"""
raise VibeCoded()