Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
037d994b
Commit
037d994b
authored
9 months ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Replace HAVE_WORDEXP_H by __has_include(<wordexp.h>)
parent
9707420c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!241
M214003/develop
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.clang-format
+0
-0
0 additions, 0 deletions
.clang-format
src/cdo_features.cc
+1
-1
1 addition, 1 deletion
src/cdo_features.cc
test/bandit_tests/wildcards.cc
+30
-29
30 additions, 29 deletions
test/bandit_tests/wildcards.cc
with
31 additions
and
30 deletions
src/
.clang-format
→
.clang-format
+
0
−
0
View file @
037d994b
File moved
This diff is collapsed.
Click to expand it.
src/cdo_features.cc
+
1
−
1
View file @
037d994b
...
...
@@ -105,7 +105,7 @@ constexpr bool have_threads = true;
constexpr
bool
have_threads
=
false
;
#endif
#if
def HAVE_WORDEXP_H
#if
__has_include(<wordexp.h>)
constexpr
bool
have_wordexp
=
true
;
#else
constexpr
bool
have_wordexp
=
false
;
...
...
This diff is collapsed.
Click to expand it.
test/bandit_tests/wildcards.cc
+
30
−
29
View file @
037d994b
#include
"bandit/bandit/bandit.h"
#ifdef HAVE_CONFIG_H
#include
<config.h>
#endif
#ifdef HAVE_WORDEXP_H
#if __has_include(<wordexp.h>)
#include
"../../src/util_wildcards.h"
#include
<fstream>
//==========================================================================
go_bandit
([]()
{
// File name rules
const
std
::
string
prefix
=
"testFile"
;
const
std
::
string
suffix
=
".banditTestFile"
;
std
::
vector
<
std
::
string
>
wildcards
=
{
"*"
,
"?"
};
std
::
vector
<
std
::
string
>
wildcards
=
{
"*"
,
"?"
};
std
::
vector
<
std
::
string
>
testArgv
;
std
::
string
toBeExpanded
;
const
int
fileCount
=
5
;
const
expr
int
fileCount
=
5
;
// +1 because there has to be another string at the binning of testArgv since
// the first entry will be ignored by expand wildcards
...
...
@@ -30,45 +25,51 @@ go_bandit([]() {
//--------------------------------------------------------------------------
std
::
string
fileName
;
// Creating test files
for
(
int
fileID
=
0
;
fileID
<
fileCount
;
fileID
++
)
{
fileName
=
prefix
+
std
::
to_string
(
fileID
)
+
suffix
;
files
[
fileID
].
open
(
fileName
);
fileNames
.
push_back
(
fileName
);
files
[
fileID
].
close
();
}
for
(
int
fileID
=
0
;
fileID
<
fileCount
;
fileID
++
)
{
fileName
=
prefix
+
std
::
to_string
(
fileID
)
+
suffix
;
files
[
fileID
].
open
(
fileName
);
fileNames
.
push_back
(
fileName
);
files
[
fileID
].
close
();
}
// see comment at definition of expectedFileCnt
testArgv
.
push_back
(
"wildcards"
);
// setting the actual filenames
for
(
unsigned
int
wildCardIDX
=
0
;
wildCardIDX
<
wildcards
.
size
();
wildCardIDX
++
)
{
testArgv
.
push_back
(
prefix
+
wildcards
[
wildCardIDX
]
+
suffix
);
}
for
(
unsigned
int
wildCardIDX
=
0
;
wildCardIDX
<
wildcards
.
size
();
wildCardIDX
++
)
{
testArgv
.
push_back
(
prefix
+
wildcards
[
wildCardIDX
]
+
suffix
);
}
//for ignoring non wildcard elements as '[' and ']'
//
for ignoring non wildcard elements as '[' and ']'
int
k
=
2
;
//--------------------------------------------------------------------------
bandit
::
describe
(
"Expanding wildcard"
,
[
&
]()
{
std
::
vector
<
std
::
string
>
expandedWildCards
=
expand_wild_cards
(
testArgv
);
for
(
unsigned
int
j
=
0
;
j
<
wildcards
.
size
();
j
++
)
{
for
(
int
i
=
0
;
i
<
fileCount
;
i
++
)
{
int
argvIdx
=
k
+
i
+
(
fileCount
*
j
);
bandit
::
it
(
"has expanded the filename"
,
[
&
]()
{
AssertThat
(
expandedWildCards
[
argvIdx
],
snowhouse
::
Equals
(
fileNames
[
i
]));
});
for
(
unsigned
int
j
=
0
;
j
<
wildcards
.
size
();
j
++
)
{
for
(
int
i
=
0
;
i
<
fileCount
;
i
++
)
{
int
argvIdx
=
k
+
i
+
(
fileCount
*
j
);
bandit
::
it
(
"has expanded the filename"
,
[
&
]()
{
AssertThat
(
expandedWildCards
[
argvIdx
],
snowhouse
::
Equals
(
fileNames
[
i
]));
});
}
k
+=
2
;
}
k
+=
2
;
}
//--------------------------------------------------------------------------
});
});
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
int
result
=
bandit
::
run
(
argc
,
argv
);
return
result
;
}
#else
#define SKIPPED_TEST 77
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
int
result
=
SKIPPED_TEST
;
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment