Skip to content

Commit c011fb5

Browse files
authored
Merge pull request #4858 from tihiyn/4751
feat(#4751): partially moved tests for `pow` to `pow.eo`
2 parents 3c7254e + 126c5b5 commit c011fb5

File tree

2 files changed

+91
-91
lines changed

2 files changed

+91
-91
lines changed

eo-runtime/src/main/eo/org/eolang/ms/pow.eo

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,94 @@
102102
eq. +> @
103103
pow -42 negative-infinity
104104
0
105+
106+
# Tests that negative float raised to negative infinity equals zero.
107+
[] +> tests-negative-float-to-the-pow-of-negative-infinity-is-zero
108+
eq. +> @
109+
pow -42.5 negative-infinity
110+
0
111+
112+
# Tests that positive infinity raised to negative infinity equals zero.
113+
[] +> tests-positive-infinity-to-the-pow-of-negative-infinity-is-zero
114+
eq. +> @
115+
pow positive-infinity negative-infinity
116+
0
117+
118+
# Tests that negative infinity raised to negative infinity equals zero.
119+
[] +> tests-negative-infinity-to-the-pow-of-negative-infinity-is-zero
120+
eq. +> @
121+
pow negative-infinity negative-infinity
122+
0
123+
124+
# Tests that positive infinity raised to finite negative power equals zero.
125+
[] +> tests-positive-infinity-to-the-finite-negative-int-pow-is-zero
126+
eq. +> @
127+
pow positive-infinity -42
128+
0
129+
130+
# Tests that positive infinity raised to finite negative float power equals zero.
131+
[] +> tests-positive-infinity-to-the-finite-negative-float-pow-is-zero
132+
eq. +> @
133+
pow positive-infinity -42.2
134+
0.0
135+
136+
# Tests that 2 raised to the power of -1 equals 0.5.
137+
[] +> tests-two-to-the-pow-of-minus-one
138+
eq. +> @
139+
pow 2 -1
140+
0.5
141+
142+
# Tests that 2 raised to the power of -2 equals 0.25.
143+
[] +> tests-two-to-the-pow-of-int-minus-two
144+
eq. +> @
145+
pow 2 -2
146+
0.25
147+
148+
# Tests mathematical operation functionality.
149+
[] +> tests-two-to-the-pow-of-minus-three
150+
eq. +> @
151+
pow 2 -3
152+
0.125
153+
154+
# Tests mathematical operation functionality.
155+
[] +> tests-four-to-the-pow-of-minus-three
156+
eq. +> @
157+
pow 4 -3.0
158+
0.015625
159+
160+
# Tests mathematical operation functionality.
161+
# Check if pow more than zero.
162+
[] +> tests-zero-to-the-pow-of-positive-int-is-zero
163+
eq. +> @
164+
pow 0 4
165+
0
166+
167+
# Tests mathematical operation functionality.
168+
[] +> tests-zero-to-the-pow-of-positive-float-is-zero
169+
eq. +> @
170+
pow 0 4.2
171+
0
172+
173+
# Tests mathematical operation functionality.
174+
[] +> tests-zero-to-the-pow-of-positive-infinity-is-zero
175+
eq. +> @
176+
pow 0 positive-infinity
177+
0
178+
179+
# Tests mathematical operation functionality.
180+
[] +> tests-negative-int-to-the-pow-of-positive-infinity-is-positive-infinity
181+
eq. +> @
182+
pow -10 positive-infinity
183+
positive-infinity
184+
185+
# Tests mathematical operation functionality.
186+
[] +> tests-negative-float-to-the-pow-of-positive-infinity-is-infinity
187+
eq. +> @
188+
pow -4.2 positive-infinity
189+
positive-infinity
190+
191+
# Tests mathematical operation functionality.
192+
[] +> tests-positive-int-to-the-pow-of-positive-infinity-is-positive-infinity
193+
eq. +> @
194+
pow 42 positive-infinity
195+
positive-infinity

eo-runtime/src/main/eo/org/eolang/ms/real.eo

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -38,97 +38,6 @@
3838
# It's atom, don't forget change `EOreal$EOasin`.
3939
[] > asin ?
4040

41-
# Tests that negative float raised to negative infinity equals zero.
42-
[] +> tests-negative-float-to-the-pow-of-negative-infinity-is-zero
43-
eq. +> @
44-
pow -42.5 negative-infinity
45-
0
46-
47-
# Tests that positive infinity raised to negative infinity equals zero.
48-
[] +> tests-positive-infinity-to-the-pow-of-negative-infinity-is-zero
49-
eq. +> @
50-
pow positive-infinity negative-infinity
51-
0
52-
53-
# Tests that negative infinity raised to negative infinity equals zero.
54-
[] +> tests-negative-infinity-to-the-pow-of-negative-infinity-is-zero
55-
eq. +> @
56-
pow negative-infinity negative-infinity
57-
0
58-
59-
# Tests that positive infinity raised to finite negative power equals zero.
60-
[] +> tests-positive-infinity-to-the-finite-negative-int-pow-is-zero
61-
eq. +> @
62-
pow positive-infinity -42
63-
0
64-
65-
# Tests that positive infinity raised to finite negative float power equals zero.
66-
[] +> tests-positive-infinity-to-the-finite-negative-float-pow-is-zero
67-
eq. +> @
68-
pow positive-infinity -42.2
69-
0.0
70-
71-
# Tests that 2 raised to the power of -1 equals 0.5.
72-
[] +> tests-two-to-the-pow-of-minus-one
73-
eq. +> @
74-
pow 2 -1
75-
0.5
76-
77-
# Tests that 2 raised to the power of -2 equals 0.25.
78-
[] +> tests-two-to-the-pow-of-int-minus-two
79-
eq. +> @
80-
pow 2 -2
81-
0.25
82-
83-
# Tests mathematical operation functionality.
84-
[] +> tests-two-to-the-pow-of-minus-three
85-
eq. +> @
86-
pow 2 -3
87-
0.125
88-
89-
# Tests mathematical operation functionality.
90-
[] +> tests-four-to-the-pow-of-minus-three
91-
eq. +> @
92-
pow 4 -3.0
93-
0.015625
94-
95-
# Tests mathematical operation functionality.
96-
# Check if pow more than zero.
97-
[] +> tests-zero-to-the-pow-of-positive-int-is-zero
98-
eq. +> @
99-
pow 0 4
100-
0
101-
102-
# Tests mathematical operation functionality.
103-
[] +> tests-zero-to-the-pow-of-positive-float-is-zero
104-
eq. +> @
105-
pow 0 4.2
106-
0
107-
108-
# Tests mathematical operation functionality.
109-
[] +> tests-zero-to-the-pow-of-positive-infinity-is-zero
110-
eq. +> @
111-
pow 0 positive-infinity
112-
0
113-
114-
# Tests mathematical operation functionality.
115-
[] +> tests-negative-int-to-the-pow-of-positive-infinity-is-positive-infinity
116-
eq. +> @
117-
pow -10 positive-infinity
118-
positive-infinity
119-
120-
# Tests mathematical operation functionality.
121-
[] +> tests-negative-float-to-the-pow-of-positive-infinity-is-infinity
122-
eq. +> @
123-
pow -4.2 positive-infinity
124-
positive-infinity
125-
126-
# Tests mathematical operation functionality.
127-
[] +> tests-positive-int-to-the-pow-of-positive-infinity-is-positive-infinity
128-
eq. +> @
129-
pow 42 positive-infinity
130-
positive-infinity
131-
13241
# Tests mathematical operation functionality.
13342
[] +> tests-positive-float-to-the-pow-of-positive-infinity-is-positive-infinity
13443
eq. +> @

0 commit comments

Comments
 (0)