-
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.
test: split tst.str_comparison-basic.d into with and without NULL tes…
…ting Since NULL strings are not supported yet, the tst.str_comparison-basic.d test is failing even though the non-NULL case should PASS without any problem. The test is now written as two tests: one that exercises the case of NULL strings and one that does not. Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
2 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
test/unittest/operators/tst.str_comparison-basic-with-NULL.d
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,75 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
/* @@xfail: No support for NULL strings yet */ | ||
|
||
/* | ||
* ASSERTION: String comparisons work. | ||
* | ||
* SECTION: Operators | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
BEGIN | ||
{ | ||
nerrors = 0; | ||
|
||
s1 = "abcdefghi"; | ||
s2 = "jklmnopqr"; | ||
s3 = "stuvwxyz!"; | ||
|
||
nerrors += (s1 <= s2 ? 0 : 1); | ||
nerrors += (s1 < s2 ? 0 : 1); | ||
nerrors += (s1 == s2 ? 1 : 0); | ||
nerrors += (s1 != s2 ? 0 : 1); | ||
nerrors += (s1 >= s2 ? 1 : 0); | ||
nerrors += (s1 > s2 ? 1 : 0); | ||
|
||
nerrors += (s2 <= s2 ? 0 : 1); | ||
nerrors += (s2 < s2 ? 1 : 0); | ||
nerrors += (s2 == s2 ? 0 : 1); | ||
nerrors += (s2 != s2 ? 1 : 0); | ||
nerrors += (s2 >= s2 ? 0 : 1); | ||
nerrors += (s2 > s2 ? 1 : 0); | ||
|
||
nerrors += (s3 <= s2 ? 1 : 0); | ||
nerrors += (s3 < s2 ? 1 : 0); | ||
nerrors += (s3 == s2 ? 1 : 0); | ||
nerrors += (s3 != s2 ? 0 : 1); | ||
nerrors += (s3 >= s2 ? 0 : 1); | ||
nerrors += (s3 > s2 ? 0 : 1); | ||
|
||
s2 = NULL; | ||
nerrors += (s3 <= s2 ? 1 : 0); | ||
nerrors += (s3 < s2 ? 1 : 0); | ||
nerrors += (s3 == s2 ? 1 : 0); | ||
nerrors += (s3 != s2 ? 0 : 1); | ||
nerrors += (s3 >= s2 ? 0 : 0); | ||
nerrors += (s3 > s2 ? 0 : 0); | ||
|
||
nerrors += (s2 <= s3 ? 0 : 1); | ||
nerrors += (s2 < s3 ? 0 : 1); | ||
nerrors += (s2 == s3 ? 1 : 0); | ||
nerrors += (s2 != s3 ? 0 : 1); | ||
nerrors += (s2 >= s3 ? 1 : 0); | ||
nerrors += (s2 > s3 ? 1 : 0); | ||
|
||
s3 = NULL; | ||
nerrors += (s2 <= s3 ? 0 : 1); | ||
nerrors += (s2 < s3 ? 1 : 0); | ||
nerrors += (s2 == s3 ? 0 : 1); | ||
nerrors += (s2 != s3 ? 1 : 0); | ||
nerrors += (s2 >= s3 ? 0 : 1); | ||
nerrors += (s2 > s3 ? 1 : 0); | ||
|
||
printf("%d errors\n", nerrors); | ||
exit(nerrors == 0 ? 0 : 1); | ||
} | ||
ERROR | ||
{ | ||
exit(1); | ||
} |
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