update tests and examples after the mutability fix
parent
b720bb2e77
commit
f6d06fcda2
|
@ -32,7 +32,7 @@ fn main() {
|
||||||
height: height
|
height: height
|
||||||
width: width
|
width: width
|
||||||
}
|
}
|
||||||
mut window := glfw.create_window(glfw.WinCfg {
|
window := glfw.create_window(glfw.WinCfg {
|
||||||
width: width
|
width: width
|
||||||
height: height
|
height: height
|
||||||
borderless: false
|
borderless: false
|
||||||
|
|
|
@ -262,8 +262,8 @@ fn test_push_many() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_reverse() {
|
fn test_reverse() {
|
||||||
mut a := [1, 2, 3, 4]
|
a := [1, 2, 3, 4]
|
||||||
mut b := ['test', 'array', 'reverse']
|
b := ['test', 'array', 'reverse']
|
||||||
c := a.reverse()
|
c := a.reverse()
|
||||||
d := b.reverse()
|
d := b.reverse()
|
||||||
for i, _ in c {
|
for i, _ in c {
|
||||||
|
|
|
@ -172,7 +172,7 @@ fn test_replace() {
|
||||||
assert b.replace('B', '') == 'onetwothree'
|
assert b.replace('B', '') == 'onetwothree'
|
||||||
b = '**char'
|
b = '**char'
|
||||||
assert b.replace('*char', 'byteptr') == '*byteptr'
|
assert b.replace('*char', 'byteptr') == '*byteptr'
|
||||||
mut c :='abc'
|
c :='abc'
|
||||||
assert c.replace('','-') == c
|
assert c.replace('','-') == c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ fn test_capitalize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_title() {
|
fn test_title() {
|
||||||
mut s := 'hello world'
|
s := 'hello world'
|
||||||
assert s.title() == 'Hello World'
|
assert s.title() == 'Hello World'
|
||||||
s.to_upper()
|
s.to_upper()
|
||||||
assert s.title() == 'Hello World'
|
assert s.title() == 'Hello World'
|
||||||
|
@ -500,6 +500,7 @@ fn test_atoi() {
|
||||||
|
|
||||||
fn test_raw_inter() {
|
fn test_raw_inter() {
|
||||||
world := 'world'
|
world := 'world'
|
||||||
|
println(world)
|
||||||
s := r'hello\n$world'
|
s := r'hello\n$world'
|
||||||
assert s == r'hello\n$world'
|
assert s == r'hello\n$world'
|
||||||
assert s.contains('$')
|
assert s.contains('$')
|
||||||
|
|
|
@ -134,7 +134,7 @@ fn test_complex_angle(){
|
||||||
assert (c.angle() * 180 / math.pi).eq(135)
|
assert (c.angle() * 180 / math.pi).eq(135)
|
||||||
c = cmplx.complex(-1, -1)
|
c = cmplx.complex(-1, -1)
|
||||||
assert (c.angle() * 180 / math.pi).eq(-135)
|
assert (c.angle() * 180 / math.pi).eq(-135)
|
||||||
mut cc := c.conjugate()
|
cc := c.conjugate()
|
||||||
assert (cc.angle() + c.angle()).eq(0)
|
assert (cc.angle() + c.angle()).eq(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ fn test_fraction_equals() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_gcd_and_reduce(){
|
fn test_gcd_and_reduce(){
|
||||||
mut f := fractions.fraction(3, 9)
|
f := fractions.fraction(3, 9)
|
||||||
assert f.gcd() == 3
|
assert f.gcd() == 3
|
||||||
assert f.reduce().equals(fractions.fraction(1, 3))
|
assert f.reduce().equals(fractions.fraction(1, 3))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import net
|
import net
|
||||||
|
|
||||||
fn test_socket() {
|
fn test_socket() {
|
||||||
mut server := net.listen(0) or {
|
server := net.listen(0) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
server_port := server.get_port()
|
server_port := server.get_port()
|
||||||
mut client := net.dial('127.0.0.1', server_port) or {
|
client := net.dial('127.0.0.1', server_port) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
mut socket := server.accept() or {
|
socket := server.accept() or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue