Example #1
0
   int methodTest(void)
   {
      gpstk::TestUtil testFramework( "ValidType", "Various Methods", __FILE__, __LINE__ );
      std::string failMesg;

      gpstk::ValidType<float> vfloat0;

      failMesg = "Is the invalid Valid object set as valid?";
      testFramework.assert(!vfloat0.is_valid(), failMesg, __LINE__);

      failMesg = "Is the invalid Valid object's value 0?";
      testFramework.assert(std::abs(vfloat0.get_value()) < eps, failMesg, __LINE__);

      gpstk::ValidType<float> vfloat (5);

      failMesg = "Does the get_value method return the correct value?";
      testFramework.assert(vfloat.get_value() == 5, failMesg, __LINE__);

      failMesg = "Is the valid Valid object set as valid?";
      testFramework.assert(vfloat.is_valid(), failMesg, __LINE__);

      vfloat.set_valid(false);

      failMesg = "Was the valid Valid object correctly set to invalid?";
      testFramework.assert(!vfloat.is_valid(), failMesg, __LINE__);

      return testFramework.countFails();
   }
Example #2
0
basis::basis(const vec &pex, const vec &pey, const vec &pez, 
	     const String& pname) {
  pvecerror("basis::basis(vec &pex, vec &pey, vec &pez, char pname[12])");
  if (!check_perp(pex,pey,vprecision) || 
      !check_perp(pex,pez,vprecision) || 
      !check_perp(pey,pez,vprecision)) {
    mcerr<<"ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n"
	 <<"the vectors are not perpendicular\n";
    mcerr<<" pex,pey,pez:\n";
    mcerr<<pex<<pey<<pez;
    mcerr<<"name="<<pname<<'\n';
    spexit(mcerr);
  }
  //if(length(pex)!=vfloat(1.0) || 
  //   length(pey)!=vfloat(1.0) ||
  //   length(pez)!=vfloat(1.0) )
  if (not_apeq(length(pex), vfloat(1.0)) || 
      not_apeq(length(pey), vfloat(1.0)) ||
      not_apeq(length(pez), vfloat(1.0))) {
    mcerr<<"ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n"
	 <<"the vectors are not of unit length\n";
    mcerr<<" pex,pey,pez:\n";
    mcerr<<pex<<pey<<pez;
    mcerr<<"name="<<pname<<'\n';
    spexit(mcerr);
  }
  if (not_apeq(pex||pey , pez, vprecision)) {
    mcerr<<"ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n";
    mcerr<<"wrong direction of pez\n";
    mcerr<<" pex,pey,pez:\n";
    mcerr<<pex<<pey<<pez;
    mcerr<<"name="<<pname<<'\n';
    spexit(mcerr);
  }
  name = pname;
  ex = pex;
  ey = pey;
  ez = pez;
}
Example #3
0
INT32 Module3(INT16 *speech_samples, const UINT32 file_length, INT32 *hosm_Nparams, 
			  FLOAT *hosm_params, FLOAT SubjectiveMOS)
{		
	typInputParameter InParameter;   
	typChannel	channel;             
	INT32		RetVal=0;              
	FLOAT       *ReferenceData=NULL;
	FLOAT       fHOSM_params[NR_OF_RESULTS];

	SubjectiveMOS = 0;
	ReferenceData = (FLOAT *)calloc(file_length, sizeof(FLOAT));
	if(ReferenceData == 0)
		return -1;

	channel.file[REFER_FILE].Fptr = 0;
	InParameter.MOS = MAX_MOS_VALUE;                                    
	                                                          
	vfloat(speech_samples, 1,ReferenceData, 1, file_length);  
	InParameter.ReferData = ReferenceData;                    
	                                                          
	InParameter.Frequency     = 8;                            
	channel.file[REFER_FILE].filetype = 3;                    
	                                                          
	RetVal = initStructures(&InParameter, &channel);          

	channel.file[REFER_FILE].FileSize = file_length*2;
	channel.file[REFER_FILE].start = 0;
	channel.file[REFER_FILE].stop  = channel.file[REFER_FILE].FileSize;
	
	RetVal = hosm (&InParameter, &channel, fHOSM_params);    

	vmov(fHOSM_params, 1, hosm_params, 1, NR_OF_RESULTS);

	*hosm_Nparams = (INT32) NR_OF_RESULTS;

	free(ReferenceData);
	
	return RetVal;
}