File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,8 @@ compile_erlang(bs_append_extra_words)
427427
428428compile_erlang(test_monotonic_time)
429429
430+ compile_erlang(exactly_eq)
431+
430432compile_erlang(spawn_opt_monitor_normal)
431433compile_erlang(spawn_opt_monitor_throw)
432434compile_erlang(spawn_opt_demonitor_normal)
@@ -842,6 +844,8 @@ add_custom_target(erlang_test_modules DEPENDS
842844
843845 test_monotonic_time.beam
844846
847+ exactly_eq.beam
848+
845849 spawn_opt_monitor_normal.beam
846850 spawn_opt_monitor_throw.beam
847851 spawn_opt_demonitor_normal.beam
Original file line number Diff line number Diff line change 1+ %
2+ % This file is part of AtomVM.
3+ %
4+ % Copyright 2023 Davide Bettio <[email protected] >5+ %
6+ % Licensed under the Apache License, Version 2.0 (the "License");
7+ % you may not use this file except in compliance with the License.
8+ % You may obtain a copy of the License at
9+ %
10+ % http://www.apache.org/licenses/LICENSE-2.0
11+ %
12+ % Unless required by applicable law or agreed to in writing, software
13+ % distributed under the License is distributed on an "AS IS" BASIS,
14+ % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ % See the License for the specific language governing permissions and
16+ % limitations under the License.
17+ %
18+ % SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
19+ %
20+
21+ -module (exactly_eq ).
22+
23+ -export ([start /0 , fact /3 ]).
24+
25+ start () ->
26+ A = fact (4 , 1 , 1 ),
27+ B = fact (4 , 1.0 , 1.0 ),
28+ test (not (A =:= B )) +
29+ test (A =/= B ) * 2 +
30+ test (A == B ) * 4 .
31+
32+ test (true ) ->
33+ 1 ;
34+ test (false ) ->
35+ 0 .
36+
37+ fact (N , _D , Acc ) when N < 1 ->
38+ Acc ;
39+ fact (N , D , Acc ) ->
40+ fact (N - D , D , Acc * N ).
Original file line number Diff line number Diff line change @@ -454,6 +454,8 @@ struct Test tests[] = {
454454
455455 TEST_CASE_EXPECTED (test_monotonic_time , 1 ),
456456
457+ TEST_CASE_EXPECTED (exactly_eq , 7 ),
458+
457459 // Tests relying on echo driver
458460 TEST_CASE_ATOMVM_ONLY (pingpong , 1 ),
459461
You can’t perform that action at this time.
0 commit comments