Skip to content

Commit 115b17e

Browse files
committed
add diagnostic tests
1 parent cb278a5 commit 115b17e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: mlir-opt %s --split-input-file --verify-diagnostics
2+
3+
#my_poly = #polynomial.polynomial<y + x**1024>
4+
// expected-error@below {{polynomials must have one indeterminate, but there were multiple: y, x}}
5+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
6+
7+
// -----
8+
9+
// expected-error@below {{expected integer value}}
10+
// expected-error@below {{found invalid integer exponent}}
11+
#my_poly = #polynomial.polynomial<5 + x**f>
12+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
13+
14+
// -----
15+
16+
// expected-error@below {{at most one monomial may have exponent 2, but found multiple}}
17+
#my_poly = #polynomial.polynomial<5 + x**2 + 3x**2>
18+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
19+
20+
// -----
21+
22+
// expected-error@below {{expected '>'}}
23+
// expected-error@below {{expected + and more monomials, or > to end polynomial attribute}}
24+
#my_poly = #polynomial.polynomial<5 + x**2 7>
25+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
26+
27+
// -----
28+
29+
#my_poly = #polynomial.polynomial<5 + x**2 +>
30+
// expected-error@below {{expected another monomial after +, but found > ending attribute}}
31+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
32+
33+
// -----
34+
35+
#my_poly = #polynomial.polynomial<5 + x**2>
36+
// expected-error@below {{coefficientType must specify an integer type}}
37+
#ring1 = #polynomial.ring<coefficientType=f64, coefficientModulus=2837465, polynomialModulus=#my_poly>
38+
39+
// -----
40+
41+
#my_poly = #polynomial.polynomial<5 + x**2>
42+
// expected-error@below {{expected integer value}}
43+
// expected-error@below {{invalid coefficient modulus}}
44+
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=x, polynomialModulus=#my_poly>
File renamed without changes.

0 commit comments

Comments
 (0)