Revision 1972

trunk/tests/gtests/test_ivector.cpp (revision 1972)
1
#include <gtest/gtest.h>
2
#include <fvar.hpp>
3

  
4
class test_ivector: public ::testing::Test {};
5

  
6
TEST_F(test_ivector, constructor)
7
{
8
  ivector v;
9
  EXPECT_EQ(0, v.size());
10
}
11
TEST_F(test_ivector, initialize)
12
{
13
  ivector v(1, 10);
14
  EXPECT_EQ(10, v.size());
15
  for (int i = 1; i <= 10; i++)
16
  {
17
    v(i) = i;
18
  }
19
  for (int i = 1; i <= 10; i++)
20
  {
21
    EXPECT_EQ(i, v(i));
22
  }
23
  v.initialize();
24
  for (int i = 1; i <= 10; i++)
25
  {
26
    EXPECT_EQ(0, v(i));
27
  }
28
}
trunk/tests/gtests/Makefile (revision 1972)
10 10
 test_ad_comm.cpp\
11 11
 test_gradient_structure.cpp\
12 12
 test_option_match.cpp\
13
 test_ivector.cpp\
13 14
 test_lvector.cpp\
14 15
 test_df3_two_variable.cpp\
15 16
 test_adjson.cpp\
trunk/src/GNUmakefile (revision 1972)
331 331
ifeq ($(SHELL),cmd)
332 332
	if not exist ${DIST}\include md ${DIST}\include
333 333
	copy linad99\fvar.hpp ${DIST}\include
334
	copy linad99\ivector.h ${DIST}\include
334 335
	copy linad99\dfpool.h ${DIST}\include
335 336
	copy linad99\factors.h ${DIST}\include
336 337
	copy tools99\adoption.hpp ${DIST}\include
......
350 351
else
351 352
	mkdir -p ${DIST}/include
352 353
	cp linad99/fvar.hpp ${DIST}/include
354
	cp linad99/ivector.h ${DIST}/include
353 355
	cp linad99/dfpool.h ${DIST}/include
354 356
	cp linad99/factors.h ${DIST}/include
355 357
	cp tools99/adoption.hpp ${DIST}/include
trunk/src/linad99/fvar.hpp (revision 1972)
637 637
   friend class ivector;
638 638
};
639 639

  
640
#include <ivector.h>
640 641

  
641 642
/**
642 643
 * Description not yet available.
643 644
 * \param
644 645
 */
645
class ivector
646
{
647
 protected:
648
   int index_min;
649
   int index_max;
650
   int *v;
651
   vector_shapex *shape;
652

  
653
 public:
654
   int allocated(void) const
655
   {
656
      return (shape != NULL);
657
   }
658

  
659
   ivector & operator --(void)
660
   {
661
      index_min--;
662
      index_max--;
663
      v++;
664
      return *this;
665
   }
666
   void reallocate(double size);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff