[Home]
[
prev
] [
up
] [
next
] ((test/sitools/sitools.as))
34.1
Test Integer Square Root
754a
⟨
test sqrt
754a
⟩
≡
(
753
)
754b
⊳
testSqrt1():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
-1,
sqrt(-7));
}
Uses
I
47
and
SmallIntegerTools
555
.
754b
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
754a
754c
⊳
testSqrt2():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
0,
sqrt
0);
assertEquals(
I
,
1,
sqrt
1);
}
Uses
I
47
and
SmallIntegerTools
555
.
754c
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
754b
755a
⊳
testSqrt3():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
1,
sqrt
2);
assertEquals(
I
,
1,
sqrt
3);
}
Uses
I
47
and
SmallIntegerTools
555
.
755a
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
754c
755b
⊳
testSqrt4():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
2,
sqrt
4);
assertEquals(
I
,
2,
sqrt
5);
assertEquals(
I
,
2,
sqrt
6);
assertEquals(
I
,
2,
sqrt
7);
assertEquals(
I
,
2,
sqrt
8);
}
Uses
I
47
and
SmallIntegerTools
555
.
755b
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
755a
756a
⊳
testSqrt5():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
3,
sqrt
9);
assertEquals(
I
,
3,
sqrt
10);
assertEquals(
I
,
3,
sqrt
11);
assertEquals(
I
,
3,
sqrt
12);
assertEquals(
I
,
3,
sqrt
13);
assertEquals(
I
,
3,
sqrt
14);
assertEquals(
I
,
3,
sqrt
15);
}
Uses
I
47
and
SmallIntegerTools
555
.
756a
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
755b
756b
⊳
testSqrt6():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
4,
sqrt
16);
assertEquals(
I
,
4,
sqrt
17);
assertEquals(
I
,
4,
sqrt
18);
assertEquals(
I
,
4,
sqrt
19);
assertEquals(
I
,
4,
sqrt
20);
assertEquals(
I
,
4,
sqrt
21);
assertEquals(
I
,
4,
sqrt
22);
assertEquals(
I
,
4,
sqrt
23);
assertEquals(
I
,
4,
sqrt
24);
}
Uses
I
47
and
SmallIntegerTools
555
.
756b
⟨
test sqrt
754a
⟩
+
≡
(
753
)
⊲
756a
testSqrt7():
()
==
{
import
from
I
,
SmallIntegerTools
;
assertEquals(
I
,
2^15,
sqrt(2^30+3));
assertEquals(
I
,
2^15,
sqrt(2^30));
assertEquals(
I
,
2^15-1,
sqrt(2^30-35));
}
Uses
I
47
and
SmallIntegerTools
555
.
[Home]
[
prev
] [
up
] [
next
] ((test/sitools/sitools.as))