comparison UnitTestsSources/MultiThreadingTests.cpp @ 3040:07ab06af90ed

preparing for release
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Dec 2018 10:40:01 +0100
parents cb5d75143da0
children 867140c61f30 4e43e67f8ecf
comparison
equal deleted inserted replaced
3039:0293cb3d8a37 3040:07ab06af90ed
1731 { 1731 {
1732 { 1732 {
1733 Json::Value s; 1733 Json::Value s;
1734 1734
1735 DummyInstancesJob job; 1735 DummyInstancesJob job;
1736 ASSERT_EQ(0, job.GetCommandsCount()); 1736 ASSERT_EQ(0u, job.GetCommandsCount());
1737 ASSERT_EQ(0, job.GetInstancesCount()); 1737 ASSERT_EQ(0u, job.GetInstancesCount());
1738 1738
1739 job.Start(); 1739 job.Start();
1740 ASSERT_EQ(0, job.GetPosition()); 1740 ASSERT_EQ(0u, job.GetPosition());
1741 ASSERT_FALSE(job.HasTrailingStep()); 1741 ASSERT_FALSE(job.HasTrailingStep());
1742 ASSERT_FALSE(job.IsTrailingStepDone()); 1742 ASSERT_FALSE(job.IsTrailingStepDone());
1743 1743
1744 { 1744 {
1745 DummyUnserializer unserializer; 1745 DummyUnserializer unserializer;
1746 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1746 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1747 } 1747 }
1748 1748
1749 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode()); 1749 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode());
1750 ASSERT_EQ(1, job.GetPosition()); 1750 ASSERT_EQ(1u, job.GetPosition());
1751 ASSERT_FALSE(job.IsTrailingStepDone()); 1751 ASSERT_FALSE(job.IsTrailingStepDone());
1752 1752
1753 { 1753 {
1754 DummyUnserializer unserializer; 1754 DummyUnserializer unserializer;
1755 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1755 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1762 Json::Value s; 1762 Json::Value s;
1763 1763
1764 DummyInstancesJob job; 1764 DummyInstancesJob job;
1765 job.AddInstance("hello"); 1765 job.AddInstance("hello");
1766 job.AddInstance("world"); 1766 job.AddInstance("world");
1767 ASSERT_EQ(2, job.GetCommandsCount()); 1767 ASSERT_EQ(2u, job.GetCommandsCount());
1768 ASSERT_EQ(2, job.GetInstancesCount()); 1768 ASSERT_EQ(2u, job.GetInstancesCount());
1769 1769
1770 job.Start(); 1770 job.Start();
1771 ASSERT_EQ(0, job.GetPosition()); 1771 ASSERT_EQ(0u, job.GetPosition());
1772 ASSERT_FALSE(job.HasTrailingStep()); 1772 ASSERT_FALSE(job.HasTrailingStep());
1773 ASSERT_FALSE(job.IsTrailingStepDone()); 1773 ASSERT_FALSE(job.IsTrailingStepDone());
1774 1774
1775 { 1775 {
1776 DummyUnserializer unserializer; 1776 DummyUnserializer unserializer;
1777 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1777 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1778 } 1778 }
1779 1779
1780 ASSERT_EQ(JobStepCode_Continue, job.Step().GetCode()); 1780 ASSERT_EQ(JobStepCode_Continue, job.Step().GetCode());
1781 ASSERT_EQ(1, job.GetPosition()); 1781 ASSERT_EQ(1u, job.GetPosition());
1782 ASSERT_FALSE(job.IsTrailingStepDone()); 1782 ASSERT_FALSE(job.IsTrailingStepDone());
1783 1783
1784 { 1784 {
1785 DummyUnserializer unserializer; 1785 DummyUnserializer unserializer;
1786 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1786 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1787 } 1787 }
1788 1788
1789 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode()); 1789 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode());
1790 ASSERT_EQ(2, job.GetPosition()); 1790 ASSERT_EQ(2u, job.GetPosition());
1791 ASSERT_FALSE(job.IsTrailingStepDone()); 1791 ASSERT_FALSE(job.IsTrailingStepDone());
1792 1792
1793 { 1793 {
1794 DummyUnserializer unserializer; 1794 DummyUnserializer unserializer;
1795 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1795 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1800 1800
1801 { 1801 {
1802 Json::Value s; 1802 Json::Value s;
1803 1803
1804 DummyInstancesJob job; 1804 DummyInstancesJob job;
1805 ASSERT_EQ(0, job.GetInstancesCount()); 1805 ASSERT_EQ(0u, job.GetInstancesCount());
1806 ASSERT_EQ(0, job.GetCommandsCount()); 1806 ASSERT_EQ(0u, job.GetCommandsCount());
1807 job.AddTrailingStep(); 1807 job.AddTrailingStep();
1808 ASSERT_EQ(0, job.GetInstancesCount()); 1808 ASSERT_EQ(0u, job.GetInstancesCount());
1809 ASSERT_EQ(1, job.GetCommandsCount()); 1809 ASSERT_EQ(1u, job.GetCommandsCount());
1810 1810
1811 job.Start(); // This adds the trailing step 1811 job.Start(); // This adds the trailing step
1812 ASSERT_EQ(0, job.GetPosition()); 1812 ASSERT_EQ(0u, job.GetPosition());
1813 ASSERT_TRUE(job.HasTrailingStep()); 1813 ASSERT_TRUE(job.HasTrailingStep());
1814 ASSERT_FALSE(job.IsTrailingStepDone()); 1814 ASSERT_FALSE(job.IsTrailingStepDone());
1815 1815
1816 { 1816 {
1817 DummyUnserializer unserializer; 1817 DummyUnserializer unserializer;
1818 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1818 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1819 } 1819 }
1820 1820
1821 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode()); 1821 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode());
1822 ASSERT_EQ(1, job.GetPosition()); 1822 ASSERT_EQ(1u, job.GetPosition());
1823 ASSERT_TRUE(job.IsTrailingStepDone()); 1823 ASSERT_TRUE(job.IsTrailingStepDone());
1824 1824
1825 { 1825 {
1826 DummyUnserializer unserializer; 1826 DummyUnserializer unserializer;
1827 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1827 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1833 { 1833 {
1834 Json::Value s; 1834 Json::Value s;
1835 1835
1836 DummyInstancesJob job; 1836 DummyInstancesJob job;
1837 job.AddInstance("hello"); 1837 job.AddInstance("hello");
1838 ASSERT_EQ(1, job.GetInstancesCount()); 1838 ASSERT_EQ(1u, job.GetInstancesCount());
1839 ASSERT_EQ(1, job.GetCommandsCount()); 1839 ASSERT_EQ(1u, job.GetCommandsCount());
1840 job.AddTrailingStep(); 1840 job.AddTrailingStep();
1841 ASSERT_EQ(1, job.GetInstancesCount()); 1841 ASSERT_EQ(1u, job.GetInstancesCount());
1842 ASSERT_EQ(2, job.GetCommandsCount()); 1842 ASSERT_EQ(2u, job.GetCommandsCount());
1843 1843
1844 job.Start(); 1844 job.Start();
1845 ASSERT_EQ(2, job.GetCommandsCount()); 1845 ASSERT_EQ(2u, job.GetCommandsCount());
1846 ASSERT_EQ(0, job.GetPosition()); 1846 ASSERT_EQ(0u, job.GetPosition());
1847 ASSERT_TRUE(job.HasTrailingStep()); 1847 ASSERT_TRUE(job.HasTrailingStep());
1848 ASSERT_FALSE(job.IsTrailingStepDone()); 1848 ASSERT_FALSE(job.IsTrailingStepDone());
1849 1849
1850 { 1850 {
1851 DummyUnserializer unserializer; 1851 DummyUnserializer unserializer;
1852 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1852 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1853 } 1853 }
1854 1854
1855 ASSERT_EQ(JobStepCode_Continue, job.Step().GetCode()); 1855 ASSERT_EQ(JobStepCode_Continue, job.Step().GetCode());
1856 ASSERT_EQ(1, job.GetPosition()); 1856 ASSERT_EQ(1u, job.GetPosition());
1857 ASSERT_FALSE(job.IsTrailingStepDone()); 1857 ASSERT_FALSE(job.IsTrailingStepDone());
1858 1858
1859 { 1859 {
1860 DummyUnserializer unserializer; 1860 DummyUnserializer unserializer;
1861 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1861 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));
1862 } 1862 }
1863 1863
1864 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode()); 1864 ASSERT_EQ(JobStepCode_Success, job.Step().GetCode());
1865 ASSERT_EQ(2, job.GetPosition()); 1865 ASSERT_EQ(2u, job.GetPosition());
1866 ASSERT_TRUE(job.IsTrailingStepDone()); 1866 ASSERT_TRUE(job.IsTrailingStepDone());
1867 1867
1868 { 1868 {
1869 DummyUnserializer unserializer; 1869 DummyUnserializer unserializer;
1870 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); 1870 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job));