File: test_parameter.c

package info (click to toggle)
cowdancer 0.73
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 752 kB
  • ctags: 269
  • sloc: ansic: 3,822; sh: 481; makefile: 191; cpp: 6
file content (73 lines) | stat: -rwxr-xr-x 1,180 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*BINFMTC: parameter.c

 */
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "parameter.h"

/*
   Mock functions
 */
int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile)
{
  return 0;
}

int cpbuilder_login(const struct pbuilderconfig* pc)
{
  return 0;
}

int cpbuilder_execute(const struct pbuilderconfig* pc, char** av)
{
  return 0;
}

int cpbuilder_update(const struct pbuilderconfig* pc)
{
  return 0;
}

int cpbuilder_help(void)
{
  return 0;
}

int cpbuilder_create(const struct pbuilderconfig* pc)
{
  return 0;
}
/*
   end of mock functions
 */

/*
  Test size of Null Terminated String Array handling.
 */
void test_size_of_ntarray()
{
  char* test[32];
  test[0]="test1";
  test[1]="test2";
  test[2]=NULL;
  assert(size_of_ntarray(test)==2);
}

/*
  Test handling of quoted parameter string.
 */
void test_load_quoted_config()
{
  pbuilderconfig pc;
  assert(0 == load_config_file("tests/102_test_cowbuilder_debbuildopts.config", &pc));
  assert(!strcmp("-j2 -I", pc.debbuildopts));
  assert(!strcmp("/boot/vmlinuz-x.y.z", pc.kernel_image));
}

int main()
{
  test_size_of_ntarray();
  test_load_quoted_config();
  return 0;
}