-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iut: add case to test divide0 exception
Make sure divide zero exception happens as expected and fatal context is correctly printed out in logs. Signed-off-by: Dong Wang <[email protected]>
- Loading branch information
1 parent
1ed7e24
commit 9deeaee
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2023 Intel Corporation. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "iut.h" | ||
|
||
int _divider; | ||
|
||
static int test_divide0(int argc, char **argv) | ||
{ | ||
int num = 1000; | ||
|
||
num /= _divider; | ||
|
||
iut_case_print("no way to come here, %d\n", num); | ||
TEST_ASSERT_TRUE(1); | ||
|
||
return IUT_ERR_OK; | ||
} | ||
|
||
DEFINE_IUT_CASE(divide0, fatal, IUT_ATTRI_NONE); |