Commit 803b997f66cf2e915897af75a3672e6801a4b501

Authored by Jürgen Knödlseder
1 parent 498c336f

Fix GApplication unit test

src/sky/GSkyRegionCircle.cpp
@@ -412,7 +412,7 @@ std::string GSkyRegionCircle::write(void) const @@ -412,7 +412,7 @@ std::string GSkyRegionCircle::write(void) const
412 /***********************************************************************//** 412 /***********************************************************************//**
413 * @brief Print circular region 413 * @brief Print circular region
414 * 414 *
415 - * @param[in] chatter Chattiness (defaults to NORMAL). 415 + * @param[in] chatter Chattiness
416 * @return String containing region information. 416 * @return String containing region information.
417 ***************************************************************************/ 417 ***************************************************************************/
418 std::string GSkyRegionCircle::print(const GChatter& chatter) const 418 std::string GSkyRegionCircle::print(const GChatter& chatter) const
@@ -423,15 +423,16 @@ std::string GSkyRegionCircle::print(const GChatter& chatter) const @@ -423,15 +423,16 @@ std::string GSkyRegionCircle::print(const GChatter& chatter) const
423 // Continue only if chatter is not silent 423 // Continue only if chatter is not silent
424 if (chatter != SILENT) { 424 if (chatter != SILENT) {
425 425
426 - // Append string 426 + // Append header
427 result.append("=== GSkyRegionCircle ==="); 427 result.append("=== GSkyRegionCircle ===");
428 - result.append("\n(");  
429 - result.append(gammalib::str(m_centre.ra_deg()));  
430 - result.append(",");  
431 - result.append(gammalib::str(m_centre.dec_deg()));  
432 - result.append(",");  
433 - result.append(gammalib::str(m_radius));  
434 - result.append(")"); 428 +
  429 + // Append sky circle information
  430 + result.append("\n"+gammalib::parformat("Right Ascension of centre"));
  431 + result.append(gammalib::str(m_centre.ra_deg())+" deg");
  432 + result.append("\n"+gammalib::parformat("Declination of centre"));
  433 + result.append(gammalib::str(m_centre.dec_deg())+" deg");
  434 + result.append("\n"+gammalib::parformat("Radius"));
  435 + result.append(gammalib::str(m_radius)+" deg");
435 436
436 } // endif: chatter was not silent 437 } // endif: chatter was not silent
437 438
src/sky/GSkyRegions.cpp
@@ -545,7 +545,7 @@ void GSkyRegions::save(const GFilename& filename) const @@ -545,7 +545,7 @@ void GSkyRegions::save(const GFilename& filename) const
545 /***********************************************************************//** 545 /***********************************************************************//**
546 * @brief Print regions 546 * @brief Print regions
547 * 547 *
548 - * @param[in] chatter Chattiness (defaults to NORMAL). 548 + * @param[in] chatter Chattiness
549 * @return String containing region container information. 549 * @return String containing region container information.
550 * 550 *
551 * Prints all regions into a string. 551 * Prints all regions into a string.
test/test_GApplication.cpp
@@ -462,51 +462,47 @@ void TestGApplication::test_GApplication(void) @@ -462,51 +462,47 @@ void TestGApplication::test_GApplication(void)
462 462
463 // Test logging of header 2 463 // Test logging of header 2
464 fgets(line, 100, fp); 464 fgets(line, 100, fp);
465 - test_value(line, "\n", "Check log file line 14"); 465 + test_value(line, "+----------+\n", "Check log file line 14");
466 fgets(line, 100, fp); 466 fgets(line, 100, fp);
467 - test_value(line, "+----------+\n", "Check log file line 15"); 467 + test_value(line, "| Header 2 |\n", "Check log file line 15");
468 fgets(line, 100, fp); 468 fgets(line, 100, fp);
469 - test_value(line, "| Header 2 |\n", "Check log file line 16");  
470 - fgets(line, 100, fp);  
471 - test_value(line, "+----------+\n", "Check log file line 17"); 469 + test_value(line, "+----------+\n", "Check log file line 16");
472 470
473 // Test logging of header 3 471 // Test logging of header 3
474 fgets(line, 100, fp); 472 fgets(line, 100, fp);
475 - test_value(line, "\n", "Check log file line 18");  
476 - fgets(line, 100, fp);  
477 - test_value(line, "=== Header 3 ===\n", "Check log file line 19"); 473 + test_value(line, "=== Header 3 ===\n", "Check log file line 17");
478 474
479 // Test logging of parameters 475 // Test logging of parameters
480 fgets(line, 100, fp); 476 fgets(line, 100, fp);
481 - test_value(line, "+============+\n", "Check log file line 20"); 477 + test_value(line, "+============+\n", "Check log file line 18");
482 fgets(line, 100, fp); 478 fgets(line, 100, fp);
483 - test_value(line, "| Parameters |\n", "Check log file line 21"); 479 + test_value(line, "| Parameters |\n", "Check log file line 19");
484 fgets(line, 100, fp); 480 fgets(line, 100, fp);
485 - test_value(line, "+============+\n", "Check log file line 22"); 481 + test_value(line, "+============+\n", "Check log file line 20");
486 fgets(line, 100, fp); 482 fgets(line, 100, fp);
487 test_value(line, " chatter ...................: 2\n", 483 test_value(line, " chatter ...................: 2\n",
488 - "Check log file line 23"); 484 + "Check log file line 21");
489 fgets(line, 100, fp); 485 fgets(line, 100, fp);
490 test_value(line, " clobber ...................: yes\n", 486 test_value(line, " clobber ...................: yes\n",
491 - "Check log file line 24"); 487 + "Check log file line 22");
492 fgets(line, 100, fp); 488 fgets(line, 100, fp);
493 test_value(line, " debug .....................: no\n", 489 test_value(line, " debug .....................: no\n",
494 - "Check log file line 25"); 490 + "Check log file line 23");
495 fgets(line, 100, fp); 491 fgets(line, 100, fp);
496 test_value(line, " mode ......................: ql\n", 492 test_value(line, " mode ......................: ql\n",
497 - "Check log file line 26"); 493 + "Check log file line 24");
498 fgets(line, 100, fp); 494 fgets(line, 100, fp);
499 test_value(line, " logfile ...................: test_logfile.log\n", 495 test_value(line, " logfile ...................: test_logfile.log\n",
500 - "Check log file line 27"); 496 + "Check log file line 25");
501 fgets(line, 32, fp); 497 fgets(line, 32, fp);
502 test_value(line, "Application \"test_GApplication\"", 498 test_value(line, "Application \"test_GApplication\"",
503 - "Check log file line 28"); 499 + "Check log file line 26");
504 // Empty remaining characters (not checked since they are machine 500 // Empty remaining characters (not checked since they are machine
505 // dependent) 501 // dependent)
506 fgets(line, 200, fp); 502 fgets(line, 200, fp);
507 fgets(line, 32, fp); 503 fgets(line, 32, fp);
508 test_value(line, "Application \"test_GApplication\"", 504 test_value(line, "Application \"test_GApplication\"",
509 - "Check log file line 29"); 505 + "Check log file line 27");
510 506
511 // Close log file 507 // Close log file
512 fclose(fp); 508 fclose(fp);