int main(){

	int num1 = 3;  // object to act on with my functions

	int *pint;     // pointer to object to be passed to my functions
	pint = &num1;

	myint num2;
	num2.value = 6;

	std::cout << "num1 = " << num1 << std::endl;

	doubler(num1);  // by reference
	std::cout << "AFTER doubler num1 = " << num1 << std::endl;
	
	doubler(*pint);  // by reference
	std::cout << "AFTER doubler num1 = " << num1 << std::endl;
	
	tripler(pint);  // by pointer
	std::cout << "AFTER tripler num1 = " << num1 << std::endl;
	
	tripler(&num1); // by another pointer
	std::cout << "AFTER tripler num1 = " << num1 << std::endl;
	
///////////////////////////////////	
	
	std::cout << "num2 = " << num2.value << std::endl;
	
	plusone(&num2);  // by struct pointer
	std::cout << "AFTER plusone num2 = " << num2.value << std::endl;

	return 0;
}
Exemplo n.º 2
0
TEST(AffineTransform, Multiply)
{
    WebCore::AffineTransform test(6.0, 5.0, 4.0, 3.0, 2.0, 1.0);
    WebCore::AffineTransform identity;

    testValueConstruction(test);

    test.multiply(identity);

    testValueConstruction(test);

    WebCore::AffineTransform doubler(2.0, 0.0, 0.0, 2.0, 0.0, 0.0);

    test.multiply(doubler);

    testDoubled(test);

    WebCore::AffineTransform halver(0.5, 0.0, 0.0, 0.5, 0.0, 0.0);

    test.multiply(halver);

    testValueConstruction(test);

    test.multiply(halver);

    testHalved(test);
}
int main() {

  int ret_value ;
  int value = 13;
  int result;
  
  /* Test with both args NULL
   * Expected result: a return value != 0
   */
  ret_value = doubler(NULL, NULL);
  assert( ret_value != 0 );
  printf ("Test passed. Failed doubling NULL, NULL\n");
  
  /* Test with first arg NULL 
   * Expected result: a return value != 0
   */
  ret_value = doubler(NULL, &result);
  assert( ret_value!=0 );
  printf ("Test passed. Failed doubling NULL, &result\n");
  
  /* Test with second arg NULL 
   * Expected result: a return value != 0
   */
  ret_value = doubler(&value, NULL);
  assert( ret_value!=0 );
  printf ("Test passed. Failed doubling &value, NULL\n");

  /* Test with ok args 
   * Expected result: a return value 0 and the result value set to 26
   */
  ret_value = doubler(&value, &result);
  assert( ret_value == 0 );
  printf ("Test passed. doubler(&value, &result) where value was %d gave us: %d\n", value, result);
  
  return 0;
}
Exemplo n.º 4
0
int main(int argc, const char** argv) {
	gpu::gles2::GLES2Implementation o;
	o.Viewport(0,0,100,100);
	doubler(3);
	return 0;
}
Exemplo n.º 5
0
int main()
{
	printf("Twice 6 is %d, triple 6 is %d\n", doubler(6),tripler(6));
}