Newer
Older
Russell Taylor
committed
#ifndef CHECKWORKSPACESMATCHTEST_H_
#define CHECKWORKSPACESMATCHTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidAlgorithms/CheckWorkspacesMatch.h"
#include "MantidAPI/NumericAxis.h"
Russell Taylor
committed
#include "MantidKernel/UnitFactory.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidDataObjects/MDHistoWorkspace.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
#include "MantidTestHelpers/MDEventsTestHelper.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAlgorithms/CreatePeaksWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidGeometry/Instrument.h"
#include "MantidDataObjects/MDBoxBase.h"
#include "MantidKernel/V3D.h"
using namespace Mantid::Algorithms;
using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::Geometry;
Russell Taylor
committed
class CheckWorkspacesMatchTest : public CxxTest::TestSuite {
Russell Taylor
committed
public:
Russell Taylor
committed
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static CheckWorkspacesMatchTest *createSuite() {
return new CheckWorkspacesMatchTest();
}
static void destroySuite(CheckWorkspacesMatchTest *suite) { delete suite; }
Russell Taylor
committed
CheckWorkspacesMatchTest()
: ws1(WorkspaceCreationHelper::Create2DWorkspace123(2, 2)) {
Russell Taylor
committed
}
void testName() { TS_ASSERT_EQUALS(checker.name(), "CheckWorkspacesMatch"); }
Russell Taylor
committed
void testVersion() { TS_ASSERT_EQUALS(checker.version(), 1); }
void testInit() {
TS_ASSERT_THROWS_NOTHING(checker.initialize());
TS_ASSERT(checker.isInitialized());
Russell Taylor
committed
}
void testMatches() {
if (!checker.isInitialized())
checker.initialize();
MatrixWorkspace_sptr ws =
WorkspaceCreationHelper::Create2DWorkspaceBinned(10, 100);
Russell Taylor
committed
// A workspace had better match itself!
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
checker.successString());
// Same, using the Mantid::API::equals() function
TS_ASSERT(Mantid::API::equals(ws, ws));
Russell Taylor
committed
}
void testPeaks_matches() {
if (!checker.isInitialized())
checker.initialize();
std::string outWS1Name("CreatePeaks1WorkspaceTest_OutputWS");
std::string outWS2Name("CreatePeaks2WorkspaceTest_OutputWS");
Workspace2D_sptr instws =
WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(2, 10);
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING(
alg.setProperty("InstrumentWorkspace",
boost::dynamic_pointer_cast<MatrixWorkspace>(instws)));
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", outWS1Name));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumberOfPeaks", 13));
TS_ASSERT_THROWS_NOTHING(alg.execute();)
TS_ASSERT(alg.isExecuted());
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING(
alg.setProperty("InstrumentWorkspace",
boost::dynamic_pointer_cast<MatrixWorkspace>(instws)));
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", outWS2Name));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumberOfPeaks", 13));
TS_ASSERT_THROWS_NOTHING(alg.execute();)
TS_ASSERT(alg.isExecuted());
// Retrieve the workspace from data service.
PeaksWorkspace_sptr pws1, pws2;
TS_ASSERT_THROWS_NOTHING(
pws1 = boost::dynamic_pointer_cast<PeaksWorkspace>(
AnalysisDataService::Instance().retrieve(outWS1Name)));
TS_ASSERT_THROWS_NOTHING(
pws2 = boost::dynamic_pointer_cast<PeaksWorkspace>(
AnalysisDataService::Instance().retrieve(outWS2Name)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<Workspace>(pws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<Workspace>(pws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
checker.successString());
void testPeaks_extrapeak() {
if (!checker.isInitialized())
checker.initialize();
std::string outWS3Name("CreatePeaks3WorkspaceTest_OutputWS");
std::string outWS4Name("CreatePeaks4WorkspaceTest_OutputWS");
Workspace2D_sptr instws =
WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(2, 10);
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING(
alg.setProperty("InstrumentWorkspace",
boost::dynamic_pointer_cast<MatrixWorkspace>(instws)));
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", outWS3Name));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumberOfPeaks", 13));
TS_ASSERT_THROWS_NOTHING(alg.execute();)
TS_ASSERT(alg.isExecuted());
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING(
alg.setProperty("InstrumentWorkspace",
boost::dynamic_pointer_cast<MatrixWorkspace>(instws)));
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", outWS4Name));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumberOfPeaks", 14));
TS_ASSERT_THROWS_NOTHING(alg.execute();)
TS_ASSERT(alg.isExecuted());
// Retrieve the workspace from data service.
PeaksWorkspace_sptr pws1, pws2;
TS_ASSERT_THROWS_NOTHING(
pws1 = boost::dynamic_pointer_cast<PeaksWorkspace>(
AnalysisDataService::Instance().retrieve(outWS3Name)));
TS_ASSERT_THROWS_NOTHING(
pws2 = boost::dynamic_pointer_cast<PeaksWorkspace>(
AnalysisDataService::Instance().retrieve(outWS4Name)));
TS_ASSERT_EQUALS(pws1->getNumberPeaks(), 13);
TS_ASSERT_EQUALS(pws2->getNumberPeaks(), 14);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<Workspace>(pws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<Workspace>(pws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
void testEvent_matches() {
if (!checker.isInitialized())
checker.initialize();
EventWorkspace_sptr ews1 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30);
EventWorkspace_sptr ews2 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<MatrixWorkspace>(ews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<MatrixWorkspace>(ews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
checker.successString());
Janik Zikovsky
committed
// Same, using the Mantid::API::equals() function
TS_ASSERT(Mantid::API::equals(ews1, ews2));
void testEvent_different_type() {
if (!checker.isInitialized())
checker.initialize();
EventWorkspace_sptr ews2 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<MatrixWorkspace>(ews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
Janik Zikovsky
committed
// Same, using the Mantid::API::equals() function
TS_ASSERT(!Mantid::API::equals(ws1, ews2));
void testEvent_different_number_histograms() {
if (!checker.isInitialized())
checker.initialize();
EventWorkspace_sptr ews1 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30);
EventWorkspace_sptr ews2 =
WorkspaceCreationHelper::CreateEventWorkspace(15, 20, 30);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<MatrixWorkspace>(ews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<MatrixWorkspace>(ews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ews1, ews2)));
}
void testEvent_differentEventLists() {
if (!checker.isInitialized())
checker.initialize();
EventWorkspace_sptr ews1 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30);
EventWorkspace_sptr ews2 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30, 0.0, 1.0, 2);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<MatrixWorkspace>(ews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<MatrixWorkspace>(ews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ews1, ews2)));
}
void testEvent_differentBinBoundaries() {
if (!checker.isInitialized())
checker.initialize();
EventWorkspace_sptr ews1 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30, 15.0, 10.0);
EventWorkspace_sptr ews2 =
WorkspaceCreationHelper::CreateEventWorkspace(10, 20, 30, 5.0, 10.0);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<MatrixWorkspace>(ews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<MatrixWorkspace>(ews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
// Same, using the !Mantid::API::equals() function
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
TS_ASSERT((!Mantid::API::equals(ews1, ews2)));
}
void testMDEvents_matches() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeFakeMDEventWorkspace("mdev1");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeFakeMDEventWorkspace("mdev2");
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_eventtypes() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDEvent<3>, 3>(2, 0.0, 10.0, 1000, "B");
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_dims() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace4Lean::sptr mdews1 =
MDEventsTestHelper::makeMDEW<4>(5, -10.0, 10.0, 1);
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeMDEW<3>(5, -10.0, 10.0, 1);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_dimnames() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"B", "X%d");
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_dimmin() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 1.0, 10.0, 1000,
"B");
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_numdata() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 5000,
"B");
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_data() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"B");
MDBoxBase<MDLeanEvent<3>, 3> *parentBox =
dynamic_cast<MDBoxBase<MDLeanEvent<3>, 3> *>(mdews2->getBox());
parentBox->getBoxes(boxes, 1000, true);
MDBox<MDLeanEvent<3>, 3> *box =
dynamic_cast<MDBox<MDLeanEvent<3>, 3> *>(boxes[0]);
std::vector<MDLeanEvent<3>> &events = box->getEvents();
events[0].setSignal(events[0].getSignal() + offset);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDEvents_different_error() {
if (!checker.isInitialized())
checker.initialize();
MDEventWorkspace3Lean::sptr mdews1 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"A");
MDEventWorkspace3Lean::sptr mdews2 =
MDEventsTestHelper::makeAnyMDEW<MDLeanEvent<3>, 3>(2, 0.0, 10.0, 1000,
"B");
MDBoxBase<MDLeanEvent<3>, 3> *parentBox =
dynamic_cast<MDBoxBase<MDLeanEvent<3>, 3> *>(mdews2->getBox());
parentBox->getBoxes(boxes, 1000, true);
MDBox<MDLeanEvent<3>, 3> *box =
dynamic_cast<MDBox<MDLeanEvent<3>, 3> *>(boxes[0]);
std::vector<MDLeanEvent<3>> &events = box->getEvents();
events[0].setErrorSquared(events[0].getErrorSquared() + offset);
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdews1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdews2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHisto_matches() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4);
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_dims() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4);
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_dimnames() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3);
const int dims = 3;
std::size_t numBins[dims] = {10, 10, 10};
Mantid::coord_t min[dims] = {0.0, 0.0, 0.0};
Mantid::coord_t max[dims] = {10.0, 10.0, 10.0};
std::vector<std::string> names;
names.push_back("h");
names.push_back("k");
names.push_back("l");
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
3, 5.0, 1.0, numBins, min, max, names);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_dimbins() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3);
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3, 5);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_dimmax() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3);
Mantid::coord_t max = static_cast<Mantid::coord_t>(10.1);
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 3, 10, max);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_data() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4);
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.1, 4);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Tolerance", 1.0e-5));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testMDHist_different_error() {
if (!checker.isInitialized())
checker.initialize();
MDHistoWorkspace_sptr mdhws1 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4);
MDHistoWorkspace_sptr mdhws2 =
MDEventsTestHelper::makeFakeMDHistoWorkspace(5.0, 4, 10, 10.0, 1.1);
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace1", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws1)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty(
"Workspace2", boost::dynamic_pointer_cast<IMDWorkspace>(mdhws2)));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Tolerance", 1.0e-5));
TS_ASSERT(checker.execute());
TS_ASSERT_DIFFERS(checker.getPropertyValue("Result"),
checker.successString());
}
void testDifferentSize() {
if (!checker.isInitialized())
checker.initialize();
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create1DWorkspaceFib(2);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "Size mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testHistNotHist() {
if (!checker.isInitialized())
checker.initialize();
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2, true);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Histogram/point-like mismatch");
Janik Zikovsky
committed
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDistNonDist() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Russell Taylor
committed
ws2->isDistribution(true);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Distribution flag mismatch");
Janik Zikovsky
committed
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentAxisType() {
if (!checker.isInitialized())
checker.initialize();
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Mantid::API::Axis *const newAxis = new Mantid::API::NumericAxis(2);
ws2->replaceAxis(1, newAxis);
Russell Taylor
committed
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute())
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Axis 1 type mismatch");
Janik Zikovsky
committed
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentAxisTitles() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Russell Taylor
committed
ws2->getAxis(0)->title() = "blah";
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Axis 0 title mismatch");
Janik Zikovsky
committed
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentAxisUnit() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->getAxis(0)->unit() =
Mantid::Kernel::UnitFactory::Instance().create("Wavelength");
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Axis 0 unit mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
}
void testDifferentAxisValues() {
if (!checker.isInitialized())
checker.initialize();
Mantid::API::MatrixWorkspace_sptr ws1local =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
// Put numeric axes on these workspaces as checkAxes won't test values on
// spectra axes
Axis *newAxisWS1 = new NumericAxis(ws1local->getAxis(1)->length());
newAxisWS1->setValue(0, 1);
newAxisWS1->setValue(1, 2);
Axis *newAxisWS2 = new NumericAxis(ws2->getAxis(1)->length());
newAxisWS2->setValue(0, 1);
newAxisWS2->setValue(1, 2);
ws1local->replaceAxis(1, newAxisWS1);
ws2->replaceAxis(1, newAxisWS2);
// Check that it's all good
TS_ASSERT((Mantid::API::equals(ws1local, ws2)));
// Now change a value in one axis
ws2->getAxis(1)->setValue(1, 99);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1local));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute())
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Axis 1 values mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1local, ws2)));
Russell Taylor
committed
}
void testDifferentYUnit() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Russell Taylor
committed
ws2->setYUnit("blah");
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "YUnit mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentSpectraMap() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->getSpectrum(0)->setSpectrumNo(1234);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Spectrum number mismatch");
ws2 = WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->getSpectrum(0)->setDetectorID(99);
ws2->getSpectrum(1)->setDetectorID(98);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Detector IDs mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentInstruments() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Mantid::Geometry::Instrument_sptr instrument(
new Mantid::Geometry::Instrument("different"));
Russell Taylor
committed
ws2->setInstrument(instrument);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Instrument name mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentParameterMaps() {
if (!checker.isInitialized())
checker.initialize();
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->instrumentParameters().addBool(new Mantid::Geometry::Component,
"myParam", true);
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
Russell Taylor
committed
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(
checker.getPropertyValue("Result"),
"Instrument ParameterMap mismatch (differences in ordering ignored)");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentMasking() {
if (!checker.isInitialized())
checker.initialize();
Russell Taylor
committed
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->maskBin(0, 0);
Russell Taylor
committed
ws2->dataY(0)[0] = 2;
ws2->dataE(0)[0] = 3;
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "Masking mismatch");
Mantid::API::MatrixWorkspace_sptr ws3 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws3->maskBin(0, 1);
Russell Taylor
committed
ws3->dataY(0)[1] = 2;
ws3->dataE(0)[1] = 3;
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws3));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "Masking mismatch");
// Same, using the !Mantid::API::equals() function
TS_ASSERT((!Mantid::API::equals(ws1, ws2)));
Russell Taylor
committed
}
void testDifferentSampleName() {
if (!checker.isInitialized())
checker.initialize();
checker.setProperty("CheckSample", true);
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Sofia Antony
committed
ws2->mutableSample().setName("different");
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Sample name mismatch");
void testDifferentProtonCharge() {
if (!checker.isInitialized())
checker.initialize();
checker.setProperty("CheckSample", true);
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Gigg, Martyn Anthony
committed
ws2->mutableRun().setProtonCharge(99.99);
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Proton charge mismatch");
}
void testDifferentLogs() {
if (!checker.isInitialized())
checker.initialize();
checker.setProperty("CheckSample", true);
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws2->mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<int>("Prop1", 99));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws1));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws2));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"),
"Different numbers of logs");
Mantid::API::MatrixWorkspace_sptr ws3 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws3->mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<int>("Prop2", 99));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws2));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws3));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "Log mismatch");
Mantid::API::MatrixWorkspace_sptr ws4 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
ws4->mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<int>("Prop1", 100));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace1", ws2));
TS_ASSERT_THROWS_NOTHING(checker.setProperty("Workspace2", ws4));
TS_ASSERT(checker.execute());
TS_ASSERT_EQUALS(checker.getPropertyValue("Result"), "Log mismatch");
}
void test_Input_With_Two_Groups_That_Are_The_Same_Matches() {
Gigg, Martyn Anthony
committed
// Create a group
const std::string groupName("TestGroup");
WorkspaceGroup_sptr group =
WorkspaceCreationHelper::CreateWorkspaceGroup(2, 2, 2, groupName);
Gigg, Martyn Anthony
committed
doGroupTest(groupName, groupName,
Mantid::Algorithms::CheckWorkspacesMatch::successString());
Gigg, Martyn Anthony
committed
cleanupGroup(group);
}
void test_Input_With_Two_Groups_That_Are_Different_Sizes_Fails() {
Gigg, Martyn Anthony
committed
// Create a group
const std::string groupOneName("TestGroupOne");
WorkspaceGroup_sptr groupOne =
WorkspaceCreationHelper::CreateWorkspaceGroup(2, 2, 2, groupOneName);
Gigg, Martyn Anthony
committed
const std::string groupTwoName("TestGroupTwo");
WorkspaceGroup_sptr groupTwo =
WorkspaceCreationHelper::CreateWorkspaceGroup(3, 2, 2, groupTwoName);
Gigg, Martyn Anthony
committed
doGroupTest(groupOneName, groupTwoName, "GroupWorkspaces size mismatch.",
std::map<std::string, std::string>(), true);
Gigg, Martyn Anthony
committed
cleanupGroup(groupOne);
cleanupGroup(groupTwo);
}
void test_Input_With_A_Group_And_A_Single_Workspace_Gives_Type_Mismatch() {
Gigg, Martyn Anthony
committed
const std::string groupName("CheckWorkspacesMatch_TestGroup");
WorkspaceGroup_sptr group =
WorkspaceCreationHelper::CreateWorkspaceGroup(2, 2, 2, groupName);
Mantid::API::MatrixWorkspace_sptr ws2 =
WorkspaceCreationHelper::Create2DWorkspace123(2, 2);
Gigg, Martyn Anthony
committed
const std::string wsName("CheckWorkspacesMatch_TestWS");
Mantid::API::AnalysisDataService::Instance().add(wsName, ws2);
Gigg, Martyn Anthony
committed
doGroupTest(groupName, wsName,
"Type mismatch. One workspace is a group, the other is not.");
Gigg, Martyn Anthony
committed
// Cleanup
cleanupGroup(group);
Mantid::API::AnalysisDataService::Instance().remove(wsName);
}
void test_Input_With_Two_Groups_When_Single_Item_Checking_Is_Disabled() {
Mantid::API::AnalysisDataService::Instance().clear();
Gigg, Martyn Anthony
committed
// Create a group
const std::string groupOneName("TestGroupOne");
WorkspaceGroup_sptr groupOne =
WorkspaceCreationHelper::CreateWorkspaceGroup(2, 2, 2, groupOneName);
Gigg, Martyn Anthony
committed
const std::string groupTwoName("TestGroupTwo");
WorkspaceGroup_sptr groupTwo =
WorkspaceCreationHelper::CreateWorkspaceGroup(2, 2, 2, groupTwoName);
Mantid::API::AnalysisDataServiceImpl &dataStore =
Mantid::API::AnalysisDataService::Instance();
Gigg, Martyn Anthony
committed
// Extract the zeroth element of groupTwo and add a spurious log
MatrixWorkspace_sptr zero = boost::dynamic_pointer_cast<MatrixWorkspace>(
dataStore.retrieve(groupTwo->getNames()[0]));
Gigg, Martyn Anthony
committed
TS_ASSERT(zero);
using Mantid::Kernel::PropertyWithValue;
zero->mutableRun().addProperty(
new PropertyWithValue<double>("ExtraLog", 10));
Gigg, Martyn Anthony
committed
std::map<std::string, std::string> otherProps;
Gigg, Martyn Anthony
committed
otherProps.insert(std::make_pair("CheckSample", "1"));
doGroupTest(
groupOneName, groupTwoName,
"Different numbers of logs. Inputs=[TestGroupOne_0,TestGroupTwo_0]",
otherProps);
Gigg, Martyn Anthony
committed
// Cleanup
cleanupGroup(groupOne);
cleanupGroup(groupTwo);
}
void test_empty_tableworkspaces_match() {
Mantid::Algorithms::CheckWorkspacesMatch alg;
alg.initialize();
TS_ASSERT_THROWS_NOTHING(alg.setProperty(
"Workspace1", WorkspaceFactory::Instance().createTable()));
TS_ASSERT_THROWS_NOTHING(alg.setProperty(
"Workspace2", WorkspaceFactory::Instance().createTable()));
TS_ASSERT(alg.execute());
TS_ASSERT_EQUALS(alg.getPropertyValue("Result"), "Success!");
void test_tableworkspace_different_number_of_columns_fails() {
auto table1 = WorkspaceFactory::Instance().createTable();
auto table2 = WorkspaceFactory::Instance().createTable();
table1->addColumns("int", "aColumn", 2);
table2->addColumns("int", "aColumn", 3);
Mantid::Algorithms::CheckWorkspacesMatch alg;
alg.initialize();
TS_ASSERT_THROWS_NOTHING(alg.setProperty("Workspace1", table1));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("Workspace2", table2));
TS_ASSERT(alg.execute());
TS_ASSERT_EQUALS(alg.getPropertyValue("Result"),
"Number of columns mismatch");
void test_tableworkspace_different_number_of_rows_fails() {
auto table1 = WorkspaceFactory::Instance().createTable();
auto table2 = WorkspaceFactory::Instance().createTable();
table1->addColumn("double", "aColumn");
table1->appendRow();
table1->appendRow();
table2->addColumn("double", "aColumn");
table2->appendRow();
Mantid::Algorithms::CheckWorkspacesMatch alg;
alg.initialize();
TS_ASSERT_THROWS_NOTHING(alg.setProperty("Workspace1", table1));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("Workspace2", table2));
TS_ASSERT(alg.execute());
TS_ASSERT_EQUALS(alg.getPropertyValue("Result"), "Number of rows mismatch");
void test_tableworkspace_matches_itself() {
auto table = setupTableWorkspace();
Mantid::Algorithms::CheckWorkspacesMatch alg;
alg.initialize();