1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#!/bin/sh
. $(dirname $(readlink -f $0))/framework.sh
WORDS="Fallback ~ = -5"
# Check the fallback syntax works with spaces
testsuccessequal "#ifndef TRIE_HASH_PerfectHash
#define TRIE_HASH_PerfectHash
#include <stddef.h>
#include <stdint.h>
enum PerfectKey {
Fallback = -5,
};
static enum PerfectKey PerfectHash(const char *string, size_t length);
static enum PerfectKey PerfectHash(const char *string, size_t length)
{
switch (length) {
default:
return Fallback;
}
}
#endif /* TRIE_HASH_PerfectHash */" triehash --multi-byte=0 /dev/stdin
WORDS="Fallback ~= -5"
# Check the fallback syntax works without spaces
testsuccessequal "#ifndef TRIE_HASH_PerfectHash
#define TRIE_HASH_PerfectHash
#include <stddef.h>
#include <stdint.h>
enum PerfectKey {
Fallback = -5,
};
static enum PerfectKey PerfectHash(const char *string, size_t length);
static enum PerfectKey PerfectHash(const char *string, size_t length)
{
switch (length) {
default:
return Fallback;
}
}
#endif /* TRIE_HASH_PerfectHash */" triehash --multi-byte=0 /dev/stdin
|