Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
c71c24a2
Commit
c71c24a2
authored
May 22, 2014
by
Matthias Braun
Browse files
fix unittests for missing get_mode_minus_one, fix bad max initialisation for float modes
parent
d41b8b3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/tv/tv.c
View file @
c71c24a2
...
...
@@ -509,6 +509,8 @@ void init_mode_values(ir_mode* mode)
mode
->
nan
=
get_tarval
(
buf
,
buflen
,
mode
);
fc_get_max
(
desc
,
buf
,
true
);
// min = negative maximum
mode
->
min
=
get_tarval
(
buf
,
buflen
,
mode
);
fc_get_max
(
desc
,
buf
,
false
);
mode
->
max
=
get_tarval
(
buf
,
buflen
,
mode
);
mode
->
null
=
new_tarval_from_double
(
0
.
0
,
mode
);
mode
->
one
=
new_tarval_from_double
(
1
.
0
,
mode
);
break
;
...
...
unittests/tarval_ascii.c
View file @
c71c24a2
...
...
@@ -17,6 +17,11 @@ static void test_tv(ir_tarval *tv)
}
}
static
ir_tarval
*
get_mode_minus_one
(
ir_mode
*
mode
)
{
return
tarval_neg
(
get_mode_one
(
mode
));
}
static
void
test_mode
(
ir_mode
*
mode
)
{
test_tv
(
get_mode_null
(
mode
));
...
...
unittests/tarval_float.c
View file @
c71c24a2
...
...
@@ -39,7 +39,7 @@ int main(void)
test_float
(
0
,
get_mode_null
(
mode_F
));
test_float
(
1
,
get_mode_one
(
mode_F
));
test_float
(
-
1
,
get_mode_
minus_
one
(
mode_F
));
test_float
(
-
1
,
tarval_neg
(
get_mode_one
(
mode_F
))
)
;
test_float
(
FLT_MAX
,
get_mode_max
(
mode_F
));
test_float
(
-
FLT_MAX
,
get_mode_min
(
mode_F
));
test_float
(
FLT_EPSILON
,
NULL
);
...
...
@@ -53,7 +53,7 @@ int main(void)
test_double
(
0
,
get_mode_null
(
mode_D
));
test_double
(
1
,
get_mode_one
(
mode_D
));
test_double
(
-
1
,
get_mode_
minus_
one
(
mode_D
));
test_double
(
-
1
,
tarval_neg
(
get_mode_one
(
mode_D
))
)
;
test_double
(
DBL_MAX
,
get_mode_max
(
mode_D
));
test_double
(
-
DBL_MAX
,
get_mode_min
(
mode_D
));
test_double
(
DBL_EPSILON
,
NULL
);
...
...
@@ -77,7 +77,7 @@ int main(void)
test_ldouble
(
0
,
get_mode_null
(
mode_E
));
test_ldouble
(
1
,
get_mode_one
(
mode_E
));
test_ldouble
(
-
1
,
get_mode_
minus_
one
(
mode_E
));
test_ldouble
(
-
1
,
tarval_neg
(
get_mode_one
(
mode_E
))
)
;
test_ldouble
(
LDBL_MAX
,
get_mode_max
(
mode_E
));
test_ldouble
(
-
LDBL_MAX
,
get_mode_min
(
mode_E
));
test_ldouble
(
LDBL_EPSILON
,
NULL
);
...
...
unittests/tarval_floatops.c
View file @
c71c24a2
...
...
@@ -10,7 +10,7 @@ static void check_mode(ir_mode *mode)
{
ir_tarval
*
zero
=
get_mode_null
(
mode
);
ir_tarval
*
one
=
get_mode_one
(
mode
);
ir_tarval
*
minus_one
=
get_mode_minus_one
(
mod
e
);
ir_tarval
*
minus_one
=
tarval_neg
(
on
e
);
ir_tarval
*
minus_zero
=
tarval_neg
(
zero
);
ir_tarval
*
two
=
new_tarval_from_str
(
"2"
,
1
,
mode
);
ir_tarval
*
half
=
new_tarval_from_str
(
"0.5"
,
3
,
mode
);
...
...
@@ -124,7 +124,7 @@ static void check_mode(ir_mode *mode)
ir_tarval
*
int_zero
=
get_mode_null
(
mode_Is
);
ir_tarval
*
int_one
=
get_mode_one
(
mode_Is
);
ir_tarval
*
int_minus_one
=
get_mode_
minus
_one
(
mode_Is
);
ir_tarval
*
int_minus_one
=
get_mode_
all
_one
(
mode_Is
);
ir_tarval
*
int_min
=
get_mode_min
(
mode_Is
);
ir_tarval
*
int_max
=
get_mode_max
(
mode_Is
);
assert
(
tarval_convert_to
(
zero
,
mode_Is
)
==
int_zero
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment