Vergil Cola
/
MQTTGateway2
Fork of my original MQTTGateway
sd-driver/features/filesystem/test/fsfat_test.h@0:a1734fe1ec4b, 2017-04-08 (annotated)
- Committer:
- vpcola
- Date:
- Sat Apr 08 14:43:14 2017 +0000
- Revision:
- 0:a1734fe1ec4b
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vpcola | 0:a1734fe1ec4b | 1 | /** @file fsfat_test.h |
vpcola | 0:a1734fe1ec4b | 2 | * |
vpcola | 0:a1734fe1ec4b | 3 | * mbed Microcontroller Library |
vpcola | 0:a1734fe1ec4b | 4 | * Copyright (c) 2006-2016 ARM Limited |
vpcola | 0:a1734fe1ec4b | 5 | * |
vpcola | 0:a1734fe1ec4b | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vpcola | 0:a1734fe1ec4b | 7 | * you may not use this file except in compliance with the License. |
vpcola | 0:a1734fe1ec4b | 8 | * You may obtain a copy of the License at |
vpcola | 0:a1734fe1ec4b | 9 | * |
vpcola | 0:a1734fe1ec4b | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
vpcola | 0:a1734fe1ec4b | 11 | * |
vpcola | 0:a1734fe1ec4b | 12 | * Unless required by applicable law or agreed to in writing, software |
vpcola | 0:a1734fe1ec4b | 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
vpcola | 0:a1734fe1ec4b | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vpcola | 0:a1734fe1ec4b | 15 | * See the License for the specific language governing permissions and |
vpcola | 0:a1734fe1ec4b | 16 | * limitations under the License. |
vpcola | 0:a1734fe1ec4b | 17 | * |
vpcola | 0:a1734fe1ec4b | 18 | * Header file for test support data structures and function API. |
vpcola | 0:a1734fe1ec4b | 19 | */ |
vpcola | 0:a1734fe1ec4b | 20 | #ifndef __FSFAT_TEST_H |
vpcola | 0:a1734fe1ec4b | 21 | #define __FSFAT_TEST_H |
vpcola | 0:a1734fe1ec4b | 22 | |
vpcola | 0:a1734fe1ec4b | 23 | #include <stdint.h> |
vpcola | 0:a1734fe1ec4b | 24 | #include <stdlib.h> |
vpcola | 0:a1734fe1ec4b | 25 | #include <stdbool.h> |
vpcola | 0:a1734fe1ec4b | 26 | |
vpcola | 0:a1734fe1ec4b | 27 | #ifdef __cplusplus |
vpcola | 0:a1734fe1ec4b | 28 | extern "C" { |
vpcola | 0:a1734fe1ec4b | 29 | #endif |
vpcola | 0:a1734fe1ec4b | 30 | |
vpcola | 0:a1734fe1ec4b | 31 | /* Defines */ |
vpcola | 0:a1734fe1ec4b | 32 | //#define FSFAT_INIT_1_TABLE_HEAD { "a", ""} |
vpcola | 0:a1734fe1ec4b | 33 | #define FSFAT_INIT_1_TABLE_MID_NODE { "/sd/01234567.txt", "abcdefghijklmnopqrstuvwxyz"} |
vpcola | 0:a1734fe1ec4b | 34 | //#define FSFAT_INIT_1_TABLE_TAIL { "/sd/fopentst/hello/world/animal/wobbly/dog/foot/backrght.txt", "present"} |
vpcola | 0:a1734fe1ec4b | 35 | #define FSFAT_TEST_RW_TABLE_SENTINEL 0xffffffff |
vpcola | 0:a1734fe1ec4b | 36 | #define FSFAT_TEST_BYTE_DATA_TABLE_SIZE 256 |
vpcola | 0:a1734fe1ec4b | 37 | #define FSFAT_UTEST_MSG_BUF_SIZE 256 |
vpcola | 0:a1734fe1ec4b | 38 | #define FSFAT_UTEST_DEFAULT_TIMEOUT_MS 10000 |
vpcola | 0:a1734fe1ec4b | 39 | #define FSFAT_MBED_HOSTTEST_TIMEOUT 60 |
vpcola | 0:a1734fe1ec4b | 40 | #define FSFAT_MAX_FILE_BASENAME 8 |
vpcola | 0:a1734fe1ec4b | 41 | #define FSFAT_MAX_FILE_EXTNAME 3 |
vpcola | 0:a1734fe1ec4b | 42 | #define FSFAT_BUF_MAX_LENGTH 64 |
vpcola | 0:a1734fe1ec4b | 43 | #define FSFAT_FILENAME_MAX_LENGTH 255 |
vpcola | 0:a1734fe1ec4b | 44 | |
vpcola | 0:a1734fe1ec4b | 45 | |
vpcola | 0:a1734fe1ec4b | 46 | /* support macro for make string for utest _MESSAGE macros, which dont support formatted output */ |
vpcola | 0:a1734fe1ec4b | 47 | #define FSFAT_TEST_UTEST_MESSAGE(_buf, _max_len, _fmt, ...) \ |
vpcola | 0:a1734fe1ec4b | 48 | do \ |
vpcola | 0:a1734fe1ec4b | 49 | { \ |
vpcola | 0:a1734fe1ec4b | 50 | snprintf((_buf), (_max_len), (_fmt), __VA_ARGS__); \ |
vpcola | 0:a1734fe1ec4b | 51 | }while(0); |
vpcola | 0:a1734fe1ec4b | 52 | |
vpcola | 0:a1734fe1ec4b | 53 | |
vpcola | 0:a1734fe1ec4b | 54 | /* |
vpcola | 0:a1734fe1ec4b | 55 | * Structures |
vpcola | 0:a1734fe1ec4b | 56 | */ |
vpcola | 0:a1734fe1ec4b | 57 | |
vpcola | 0:a1734fe1ec4b | 58 | /* kv data for test */ |
vpcola | 0:a1734fe1ec4b | 59 | typedef struct fsfat_kv_data_t { |
vpcola | 0:a1734fe1ec4b | 60 | const char* filename; |
vpcola | 0:a1734fe1ec4b | 61 | const char* value; |
vpcola | 0:a1734fe1ec4b | 62 | } fsfat_kv_data_t; |
vpcola | 0:a1734fe1ec4b | 63 | |
vpcola | 0:a1734fe1ec4b | 64 | |
vpcola | 0:a1734fe1ec4b | 65 | extern const uint8_t fsfat_test_byte_data_table[FSFAT_TEST_BYTE_DATA_TABLE_SIZE]; |
vpcola | 0:a1734fe1ec4b | 66 | |
vpcola | 0:a1734fe1ec4b | 67 | int32_t fsfat_test_create(const char* filename, const char* data, size_t len); |
vpcola | 0:a1734fe1ec4b | 68 | int32_t fsfat_test_delete(const char* key_name); |
vpcola | 0:a1734fe1ec4b | 69 | int32_t fsfat_test_filename_gen(char* name, const size_t len); |
vpcola | 0:a1734fe1ec4b | 70 | #ifdef __cplusplus |
vpcola | 0:a1734fe1ec4b | 71 | } |
vpcola | 0:a1734fe1ec4b | 72 | #endif |
vpcola | 0:a1734fe1ec4b | 73 | |
vpcola | 0:a1734fe1ec4b | 74 | #endif /* __FSFAT_TEST_H */ |