diff --git a/oscar/SleepLib/loader_plugins/resmed_loader.cpp b/oscar/SleepLib/loader_plugins/resmed_loader.cpp
index 45ff3284..9f4d9717 100644
--- a/oscar/SleepLib/loader_plugins/resmed_loader.cpp
+++ b/oscar/SleepLib/loader_plugins/resmed_loader.cpp
@@ -1,5 +1,6 @@
-/* SleepLib ResMed Loader Implementation
+/* SleepLib ResMed Loader Implementation
  *
+ * Copyright (c) 2019 The OSCAR Team
  * Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
  *
  * This file is subject to the terms and conditions of the GNU General Public
@@ -566,6 +567,7 @@ void ResmedLoader::ParseSTR(Machine *mach, QMap<QDate, STRFile> & STRmap)
 
 ResmedLoader::ResmedLoader()
 {
+#ifndef UNITTEST_MODE
     const QString RMS9_ICON = ":/icons/rms9.png";
     const QString RM10_ICON = ":/icons/airsense10.png";
     const QString RM10C_ICON = ":/icons/aircurve.png";
@@ -576,6 +578,7 @@ ResmedLoader::ResmedLoader()
     m_pixmap_paths[STR_ResMed_AirSense10] = RM10_ICON;
     m_pixmaps[STR_ResMed_AirCurve10] = QPixmap(RM10C_ICON);
     m_pixmap_paths[STR_ResMed_AirCurve10] = RM10C_ICON;
+#endif
     m_type = MT_CPAP;
 
     timeInTimeDelta = timeInLoadBRP = timeInLoadPLD = timeInLoadEVE = 0;
@@ -797,7 +800,7 @@ int PeekAnnotations(const QString & path, quint32 &start, quint32 &end)
 
             }
 
-            while ((data[pos] == 0) && (pos < recs)) { pos++; }
+            while ((pos < recs) && (data[pos] == 0)) { pos++; }
 
             if (pos >= recs) { break; }
         }
@@ -2244,7 +2247,7 @@ bool ResmedLoader::LoadCSL(Session *sess, const QString & path)
                 // pos++;
             }
 
-            while ((data[pos] == 0) && (pos < recs)) { pos++; }
+            while ((pos < recs) && (data[pos] == 0)) { pos++; }
 
             if (pos >= recs) { break; }
         }
@@ -2420,7 +2423,7 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path)
                 // pos++;
             }
 
-            while ((data[pos] == 0) && (pos < recs)) { pos++; }
+            while ((pos < recs) && (data[pos] == 0)) { pos++; }
 
             if (pos >= recs) { break; }
         }
diff --git a/oscar/oscar.pro b/oscar/oscar.pro
index b749d9d0..990dd9bb 100644
--- a/oscar/oscar.pro
+++ b/oscar/oscar.pro
@@ -465,11 +465,13 @@ test {
 
     SOURCES += \
         tests/prs1tests.cpp \
+        tests/resmedtests.cpp \
         tests/sessiontests.cpp
 
     HEADERS += \
         tests/AutoTest.h \
         tests/prs1tests.h \
+        tests/resmedtests.h \
         tests/sessiontests.h
 }
 
diff --git a/oscar/tests/resmedtests.cpp b/oscar/tests/resmedtests.cpp
new file mode 100644
index 00000000..9be70c02
--- /dev/null
+++ b/oscar/tests/resmedtests.cpp
@@ -0,0 +1,83 @@
+/* ResMed Unit Tests
+ *
+ * Copyright (c) 2019 The OSCAR Team
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of the source code
+ * for more details. */
+
+#include "resmedtests.h"
+//#include "sessiontests.h"
+
+#define TESTDATA_PATH "./testdata/"
+
+static ResmedLoader* s_loader = nullptr;
+static void iterateTestCards(const QString & root, void (*action)(const QString &));
+
+void ResmedTests::initTestCase(void)
+{
+    initializeStrings();
+    qDebug() << STR_TR_OSCAR + " " + getBranchVersion();
+    QString profile_path = TESTDATA_PATH "profile/";
+    Profiles::Create("test", &profile_path);
+    p_pref = new Preferences("Preferences");
+    p_pref->Open();
+    AppSetting = new AppWideSetting(p_pref);
+
+    schema::init();
+    ResmedLoader::Register();
+    s_loader = dynamic_cast<ResmedLoader*>(lookupLoader(resmed_class_name));
+}
+
+void ResmedTests::cleanupTestCase(void)
+{
+}
+
+
+// ====================================================================================================
+
+
+static void parseAndEmitSessionYaml(const QString & path)
+{
+    qDebug() << path;
+
+    // This blindly calls ResmedLoader::Open() so that we can run address and
+    // leak sanitizers against the ResMed loader.
+    //
+    // Once the ResMed loader is refactored support importing without writing
+    // to the database, this can be updated to pass the imported Session objects
+    // to SessionToYaml like the PRS1 tests do.
+    s_loader->Open(path);
+}
+
+void ResmedTests::testSessionsToYaml()
+{
+    iterateTestCards(TESTDATA_PATH "resmed/input/", parseAndEmitSessionYaml);
+}
+
+
+// ====================================================================================================
+
+void iterateTestCards(const QString & root, void (*action)(const QString &))
+{
+    QDir dir(root);
+    dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
+    dir.setSorting(QDir::Name);
+    QFileInfoList flist = dir.entryInfoList();
+
+    // Look through each folder in the given root
+    for (int i = 0; i < flist.size(); i++) {
+        QFileInfo fi = flist.at(i);
+        if (fi.isDir()) {
+            // If it contains a DATALOG folder, it's a ResMed SD card
+            QDir datalog(fi.canonicalFilePath() + QDir::separator() + "DATALOG");
+            if (datalog.exists()) {
+                // Confirm that it contains the file that the ResMed loader expects
+                QFileInfo idfile(fi.canonicalFilePath() + QDir::separator() + "Identification.tgt");
+                if (idfile.exists()) {
+                    action(fi.canonicalFilePath());
+                }
+            }
+        }
+    }
+}
diff --git a/oscar/tests/resmedtests.h b/oscar/tests/resmedtests.h
new file mode 100644
index 00000000..e39cffc0
--- /dev/null
+++ b/oscar/tests/resmedtests.h
@@ -0,0 +1,29 @@
+/* ResMed Unit Tests
+ *
+ * Copyright (c) The OSCAR Team
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of the source code
+ * for more details. */
+
+#ifndef RESMEDTESTS_H
+#define RESMEDTESTS_H
+
+#include "AutoTest.h"
+#include "../SleepLib/loader_plugins/resmed_loader.h"
+
+class ResmedTests : public QObject
+{
+    Q_OBJECT
+ 
+private slots:
+    void initTestCase();
+    //void testChunksToYaml();
+    void testSessionsToYaml();
+    void cleanupTestCase();
+};
+
+DECLARE_TEST(ResmedTests)
+
+#endif // RESMEDTESTS_H
+