diff options
author | Cong <congusbongus@gmail.com> | 2016-07-17 11:41:27 +0300 |
---|---|---|
committer | Cong <congusbongus@gmail.com> | 2016-07-17 11:41:27 +0300 |
commit | 497788421f4c9a2fa2e7fa4cc37ca3f8859bb4e3 (patch) | |
tree | a271f1dab64a289f5fb6e225a2f7dc74b586c44a | |
parent | e33a1dadc7d8f2cc80e50e992b2a596cde1f00e1 (diff) |
random_access_sample to accept optional argument
Fix cbehave function declaration
-rw-r--r-- | samples/random_access_sample.c | 4 | ||||
-rw-r--r-- | tests/cbehave/cbehave.h | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/samples/random_access_sample.c b/samples/random_access_sample.c index e37171d..ea0e7e9 100644 --- a/samples/random_access_sample.c +++ b/samples/random_access_sample.c @@ -1,11 +1,11 @@ #include <stdio.h> #include <tinydir.h> -int main(void) +int main(int argc, char *argv[]) { tinydir_dir dir; size_t i; - if (tinydir_open_sorted(&dir, ".") == -1) + if (tinydir_open_sorted(&dir, argc >= 2 ? argv[1] : ".") == -1) { perror("Error opening file"); goto bail; diff --git a/tests/cbehave/cbehave.h b/tests/cbehave/cbehave.h index ae920a6..193a4b2 100644 --- a/tests/cbehave/cbehave.h +++ b/tests/cbehave/cbehave.h @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -117,7 +117,7 @@ if (!(cond)) {\ cbehave_feature_return(__FILE__, __LINE__, ret, _state); \ goto _feature_over; \ }\ - + #define TEST_FEATURE(name) {_cbehave_feature_##name} #define SHOULD_INT_EQUAL(actual, expected) do { \ @@ -157,7 +157,7 @@ if (!(cond)) {\ } while(0) #define CBEHAVE_RUN(_description, ...)\ -int main() {\ +int main(void) {\ cbehave_feature _cfeatures[] = {__VA_ARGS__};\ return cbehave_runner(_description, _cfeatures);\ } @@ -170,7 +170,7 @@ typedef struct cbehave_feature { } cbehave_feature; int _cbehave_runner(const char *description, const cbehave_feature *features, int count); -void should_int_equal(int actual, int expected, +void should_int_equal(int actual, int expected, void *state, const char *file, int line); void should_int_gt(int val1, int val2, |