Revision 1576

trunk/tests/gtests/Makefile (revision 1576)
7 7
 test_adstring_array.cpp\
8 8
 test_dlist.cpp\
9 9
 test_ad_comm.cpp\
10
 test_df1b2atan2.obj\
11
 df1b2atan2.obj\
12 10
 test_gradient_structure.cpp\
13
 test_df_file.cpp\
14 11
 test_scalefactor.obj\
15 12
 scalefactor.obj\
13
 test_option_match.cpp\
16 14
 main.cpp
17 15

  
16
# test_df_file.cpp\
17
# test_df1b2atan2.obj\
18
# df1b2atan2.obj\
19

  
20

  
18 21
all: clean gtest-all
19 22
	./gtest-all
20 23

  
......
31 34
	CXXFLAGS="-Dmain=scalefactor" ../../admb -c -r -g $^
32 35

  
33 36
gtest-all: gtest-all.obj $(GTESTS)
34
#gtest-all: gtest-all.obj main.cpp test_scalefactor.obj scalefactor.obj
35
	CXXFLAGS=-I$(GTEST_DIR)/include ../../admb -g -r $^
37
	CXXFLAGS=-I$(GTEST_DIR)/include LDFLAGS=-pthread ../../admb -g -r $^
36 38

  
37 39
gtest-all.obj: googletest-read-only
38 40
	$(CXX) -c -g -I$(GTEST_DIR)/include -I$(GTEST_DIR) -o $@ $(GTEST_DIR)/src/gtest-all.cc
trunk/src/linad99/optmatch.cpp (revision 1576)
4 4
 * Author: David Fournier
5 5
 * Copyright (c) 2008-2012 Regents of the University of California
6 6
 */
7
/**
8
 * \file
9
 * Description not yet available.
10
 */
11
#include <admodel.h>
12 7

  
13 8
/**
14
  Checks if the program has been invoked with a particular command line argument ("string").
15
  \param argc Number of command line arguments (as in all C programs)
16
  \param argv Array  (of length argc) of command line arguments (as in all C programs)
17
  \param string Should be one of the possible command line arguments to an ADMB program.
18
  \return An index into "argv" where the match with "string" is obtained. In case of no match, the value "-1" is returned.
19
 */
9
\file
10
option_match utilities used for parsing command line arguments.
11
*/
12
#include <adstring.hpp>
20 13

  
21
 int option_match(int argc,char * argv[],const char * string)
22
 {
23
   int rval=-1;
24
   for (int i=0;i<argc;i++)
25
   {
26
     if (!strcmp(argv[i],string))
27
     {
28
       rval=i;
29
       break;
30
     }
31
   }
32
   return rval;
33
 }
34

  
35 14
/**
15
Checks if the program has been invoked with a particular command line argument
16
("string").
17
\param argc Number of command line arguments (as in all C programs)
18
\param argv Array  (of length argc) of command line arguments (as in all C
19
programs)
20
\param option Should be one of the possible command line arguments to an ADMB
21
program.
22
\return An index into "argv" where the match with "string" is obtained. In case
23
of no match, the value "-1" is returned.
24
*/
25
int option_match(int argc, char* argv[], const char* option)
26
{
27
  int match = -1;
28
  if (argv)
29
  {
30
    for (int i = 0; i < argc; i++)
31
    {
32
      const char* argvi = argv[i];
33
      if (argvi && !strcmp(argvi, option))
34
      {
35
        return i;
36
      }
37
    }
38
  }
39
  return match;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff