Skip to content

Commit d14e459

Browse files
committed
Add a multiplication test
1 parent dbb51fb commit d14e459

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/multiply.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: @cxx @cxxflags -mmcu=atmega328p @file -o @tempfile && avr-sim @tempfile
2+
3+
#include "../src/libavrlit/avr-lit.hpp"
4+
5+
using namespace test;
6+
7+
template<typename T>
8+
T __attribute__ ((noinline)) mul(T lhs, T rhs) {
9+
return lhs * rhs;
10+
}
11+
12+
void run_test() {
13+
// CHECK: mul<uint32_t>(49, 1077) = 52773
14+
eval(mul<uint32_t>(49, 1077));
15+
// CHECK: 439313136
16+
eval(mul<uint32_t>(99123, 4432));
17+
}
18+

0 commit comments

Comments
 (0)