Commit afab6a90 authored by ssides's avatar ssides
Browse files

unittest updated for GetCubeName

parent 4d24e8de
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -258,6 +258,39 @@ void IsisAml::PutFileName(const QString &paramName,
}


/**
 * Allows the insertion of a value for a parameter of type 
 * "cubename". A validity check is performed on the value passed
 * in. 
 *
 * @param paramName The partial or full name of the parameter to be modified.
 * @param value The QString representation of the value to be placed in the
 * cubename's value data member.
 */
void IsisAml::PutCubeName(const QString &paramName,
                          const QString &value) {

  IsisParameterData *param = const_cast <IsisParameterData *>(ReturnParam(paramName));

  if(param->type != "cube") {
    QString message = "Parameter [" + paramName + "] is not a cubename.";
    throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
  }

  if(param->values.size() > 0) {
    QString message = "A value for this parameter [" + paramName + "] has "
                     "already been saved (possibly by IsisGui). If you need to "
                     "change the value use \"Clear\" before the Put.";
    throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
  }

  param->values.clear();
  param->values.push_back(value);

  Verify(param);
}


// Public: Sets the value member of a parameter of type integer whose name
// starts with paramName

+2 −0
Original line number Diff line number Diff line
@@ -154,6 +154,8 @@ class IsisAml : protected IsisAmlData {
    void PutFileName(const QString &paramName, const QString &value);
    void PutFileName(const QString &paramName, const std::vector<QString> &value);

    void PutCubeName(const QString &paramName, const QString &value);

    void PutDouble(const QString &paramName, const double &value);
    void PutDouble(const QString &paramName, const std::vector<double> &value);

+1 −1
Original line number Diff line number Diff line
@@ -1449,7 +1449,7 @@ Exact and partial name match tests:
  PutFileName:
**PROGRAMMER ERROR** A value for this parameter [G0P0] has already been saved (possibly by IsisGui). If you need to change the value use "Clear" before the Put.

**PROGRAMMER ERROR** Parameter [G2P4] is not a filename.
**PROGRAMMER ERROR** Parameter [G2P4] is not a cubename.

  Cube tests:
**PROGRAMMER ERROR** Unable to get input cube attributes.  Parameter [CUBE2] is not an input. Parameter fileMode = [output].
+4 −4
Original line number Diff line number Diff line
@@ -369,8 +369,8 @@ int main(void) {
    }
    aml->Clear("G0P0");

    try { // PARAMETER NOT FILENAME
      aml->PutFileName("G2P4", "xxxxxx");
    try { // PARAMETER NOT CUBENAME
      aml->PutCubeName("G2P4", "xxxxxx");
    }
    catch(IException &error) {
      ReportError(error.toString());
@@ -379,7 +379,7 @@ int main(void) {
    cout << "  Cube tests:" << endl;

    try { // UNABLE TO GET INPUT CUBE ATTRIBUTES
      aml->PutFileName("CUBE2", "xxxxxxx.cub+1,2-4");
      aml->PutCubeName("CUBE2", "xxxxxxx.cub+1,2-4");
      CubeAttributeInput &att = aml->GetInputAttribute("CUBE2");
      cout << "    " << att.toString() << endl;
    }
@@ -389,7 +389,7 @@ int main(void) {
    aml->Clear("CUBE2");

    try { // UNABLE TO GET OUTPUT CUBE ATTRIBUTES
      aml->PutFileName("CUBE1", "yyyyyyy.cub+8-bit+BSQ+detached");
      aml->PutCubeName("CUBE1", "yyyyyyy.cub+8-bit+BSQ+detached");
      CubeAttributeOutput &att = aml->GetOutputAttribute("CUBE1");
      QString strng = att.toString();
      cout << "    Att QString  = " << strng << endl;