Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
variables.c File Reference
#include "common/darktable.h"
#include "common/variables.h"
#include <stdio.h>
+ Include dependency graph for tests/variables.c:

Data Structures

struct  test_case_t
 
struct  test_t
 

Macros

#define TEST(t)
 

Typedefs

typedef struct test_case_t test_case_t
 
typedef struct test_t test_t
 

Functions

int run_test (const test_t *test, int *n_tests, int *n_failed)
 
int main (int argc, char *argv[])
 

Variables

static const test_t test_variables
 
static const test_t test_simple_substitutions
 
static const test_t test_recursive_substitutions
 
static const test_t test_broken_variables
 
static const test_t test_escapes
 
static const test_t test_real_paths
 

Macro Definition Documentation

◆ TEST

#define TEST (   t)
Value:
{\
int n_failed = 0, n_tests = 0;\
n_test_functions++;\
printf("running test '" #t "'\n");\
n_test_functions_failed += run_test(&t, &n_tests, &n_failed);\
n_tests_overall += n_tests;\
n_failed_overall += n_failed;\
printf("%d / %d tests failed\n\n", n_failed, n_tests);\
}
int run_test(const test_t *test, int *n_tests, int *n_failed)
Definition tests/variables.c:21

Typedef Documentation

◆ test_case_t

typedef struct test_case_t test_case_t

◆ test_t

typedef struct test_t test_t

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
Todo:
: test if file with replaced ext exists
Todo:
: add a callback to set the bpp without going through the config
Todo:
: have a parameter in command line to get the export presets

References dt_cleanup(), dt_init(), FALSE, TEST, test_broken_variables, test_escapes, test_real_paths, test_recursive_substitutions, test_simple_substitutions, and test_variables.

◆ run_test()

int run_test ( const test_t test,
int *  n_tests,
int *  n_failed 
)

Variable Documentation

◆ test_broken_variables

const test_t test_broken_variables
static
Initial value:
= {
"abcdef12345abcdef", "ABCDEF12345ABCDEF", 23,
{
{"$(NONEXISTANT", "$(NONEXISTANT"},
{"x(NONEXISTANT23", "x(NONEXISTANT23"},
{"$(FILE_NAME", "$(FILE_NAME"},
{"x$(FILE_NAME", "x$(FILE_NAME"},
{"x$(TITLE-$(FILE_NAME)", "x$(TITLE-abcdef12345abcdef"},
{NULL, NULL}
}
}

Referenced by main().

◆ test_escapes

const test_t test_escapes
static
Initial value:
= {
"/home/test/Images/IMG_0123.CR2", "/home/test/", 23,
{
{"foobarbaz", "foobarbaz"},
{"foo/bar/baz", "foo/bar/baz"},
{"foo\\bar\\baz", "foobarbaz"},
{"foo\\\\bar\\\\baz", "foo\\bar\\baz"},
{"foo\\$(bar", "foo$(bar"},
{"foo$\\(bar", "foo$(bar"},
{"foo\\$\\(bar", "foo$(bar"},
{"foo\\$(bar$(SEQUENCE)baz", "foo$(bar0023baz"},
{"foo$(bar$(SEQUENCE)baz", "foo$(bar0023baz"},
{"$(FILE_FOLDER)/ansel_exported/img_$(SEQUENCE)", "/home/test/Images/ansel_exported/img_0023"},
{"$(FILE_FOLDER)/ansel_exported/$(FILE_NAME)", "/home/test/Images/ansel_exported/IMG_0123"},
{NULL, NULL}
}
}

Referenced by main().

◆ test_real_paths

const test_t test_real_paths
static
Initial value:
= {
"/home/test/Images/0023/IMG_0123.CR2", "/home/test", 23,
{
{"$(FILE_FOLDER#$(JOBCODE))", "/Images/0023"},
{"$(FILE_FOLDER#$(JOBCODE)/Images)", "/0023"},
{"$(FILE_FOLDER%$(SEQUENCE))", "/home/test/Images/"},
{"$(FILE_FOLDER%/$(SEQUENCE))", "/home/test/Images"},
{"$(FILE_FOLDER/test/$(SEQUENCE))", "/home/0023/Images/0023"},
{"$(FILE_FOLDER/test/$(SEQUENCE)-$(SEQUENCE))", "/home/0023-0023/Images/0023"},
{"$(FILE_FOLDER/test/$(SEQUENCE//0/o))", "/home/oo23/Images/0023"},
{"$(FILE_FOLDER/$(SEQUENCE)/XXX)", "/home/test/Images/XXX"},
{"$(FILE_FOLDER/$(JOBCODE)\\///media/)", "/media/Images/0023"},
{"$(FILE_FOLDER/\\/home\\/test\\///media/exports/)/ansel_exported/img_$(SEQUENCE)", "/media/exports/Images/0023/ansel_exported/img_0023"},
{"$(FILE_FOLDER/", "$(FILE_FOLDER/"},
{"$(FILE_FOLDER/home", "$(FILE_FOLDER/home"},
{"$(FILE_FOLDER/home/media", "$(FILE_FOLDER/home/media"},
{"$(FILE_FOLDER/home/media)", "/media/test/Images/0023"},
{NULL, NULL}
}
}

Referenced by main().

◆ test_recursive_substitutions

const test_t test_recursive_substitutions
static
Initial value:
= {
"abcdef12345abcdef", "ABCDEF12345ABCDEF", 23,
{
{"x$(TITLE-$(FILE_NAME))y", "xabcdef12345abcdefy"},
{"x$(TITLE-a-$(FILE_NAME)-b)y", "xa-abcdef12345abcdef-by"},
{"x$(SEQUENCE-$(FILE_NAME))y", "x0023y"},
{"x$(FILE_NAME/12345/$(SEQUENCE))y", "xabcdef0023abcdefy"},
{"x$(FILE_NAME/12345/.$(SEQUENCE).)y", "xabcdef.0023.abcdefy"},
{NULL, NULL}
}
}

Referenced by main().

◆ test_simple_substitutions

const test_t test_simple_substitutions
static

Referenced by main().

◆ test_variables

const test_t test_variables
static
Initial value:
= {
"abcdef12345abcdef", "ABCDEF12345ABCDEF", 23,
{
{"$(FILE_NAME)", "abcdef12345abcdef"},
{"foo-$(FILE_NAME)-bar", "foo-abcdef12345abcdef-bar"},
{"äöü-$(FILE_NAME)-äöü", "äöü-abcdef12345abcdef-äöü"},
{"$(FILE_NAME).$(SEQUENCE)", "abcdef12345abcdef.0023"},
{"$(NONEXISTANT)", ""},
{"foo-$(NONEXISTANT)-bar", "foo--bar"},
{NULL, NULL}
}
}

Referenced by main().