This commit is contained in:
Tobias Berger 2021-09-20 16:34:45 +02:00
parent 7979b31d9b
commit e55d2843f6
4 changed files with 197 additions and 158 deletions

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.12.3, 2021-09-17T12:29:53. --> <!-- Written by QtCreator 5.0.1, 2021-09-20T15:13:59. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{d3621eea-71f0-43b2-9e98-92c09a372104}</value> <value type="QByteArray">{02054f7f-15a3-41d0-aa9a-437b1d81f72b}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -37,6 +37,7 @@
<value type="bool" key="EditorConfiguration.MouseHiding">true</value> <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value> <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value> <value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value> <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
@ -45,28 +46,48 @@
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value> <value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value> <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value> <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value> <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.PluginSettings</variable> <variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates">
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:FractionTest">Checked</value>
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:test_addition">Checked</value>
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:test_constructor">Checked</value>
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:test_display">Checked</value>
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:test_equivalence">Checked</value>
<value type="Qt::CheckState" key="1@C:/Users/Berger.ASGARD/Documents/Git/FractionTask/tst_fractiontest.cpp:test_inequivalence">Checked</value>
</valuemap>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"> <valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value> <value type="QString">-fno-delayed-template-parsing</value>
</valuelist> </valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value> <value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.Questionable</value> <value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
<valuemap type="QVariantMap" key="ClangTools"> <valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value> <value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value> <value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">2</value> <value type="int" key="ClangTools.ParallelJobs">2</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"> <valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<value type="QString">C:/Users/$5NP000-N4QVBFC8R26B/Documents/FractionTask/FractionTask.pro</value>
</valuelist>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/> <valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/> <valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value> <value type="bool" key="ClangTools.UseGlobalSettings">true</value>
@ -76,33 +97,27 @@
<data> <data>
<variable>ProjectExplorer.Project.Target.0</variable> <variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value> <value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.1.3 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.win64_mingw81_kit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.1.3 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.613.win64_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="bool">true</value>
<value type="int" key="EnableQmlDebugging">0</value> <value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\$5NP000-N4QVBFC8R26B\Documents\build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Berger.ASGARD\Documents\Git\build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/$5NP000-N4QVBFC8R26B/Documents/build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Berger.ASGARD/Documents/Git/build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
@ -113,11 +128,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
@ -126,34 +137,25 @@
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="int" key="QtQuickCompiler">2</value>
<value type="int" key="SeparateDebugInfo">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="bool">true</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Berger.ASGARD\Documents\Git\build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Release</value>
<value type="int" key="EnableQmlDebugging">2</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Berger.ASGARD/Documents/Git/build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\$5NP000-N4QVBFC8R26B\Documents\build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/$5NP000-N4QVBFC8R26B/Documents/build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
@ -164,11 +166,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
@ -177,34 +175,27 @@
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value> <value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="bool">true</value>
<value type="int" key="EnableQmlDebugging">0</value> <value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\$5NP000-N4QVBFC8R26B\Documents\build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Berger.ASGARD\Documents\Git\build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/$5NP000-N4QVBFC8R26B/Documents/build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Berger.ASGARD/Documents/Git/build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
@ -215,11 +206,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
@ -228,6 +215,7 @@
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
@ -249,80 +237,21 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> <valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/$5NP000-N4QVBFC8R26B/Documents/FractionTask/FractionTask.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Berger.ASGARD/Documents/Git/FractionTask/FractionTask.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/$5NP000-N4QVBFC8R26B/Documents/FractionTask/FractionTask.pro</value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/Berger.ASGARD/Documents/Git/FractionTask/FractionTask.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Berger.ASGARD/Documents/Git/build-FractionTask-Desktop_Qt_6_1_3_MinGW_64_bit-Debug</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/$5NP000-N4QVBFC8R26B/Documents/build-FractionTask-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>

View file

@ -3,12 +3,14 @@
namespace FractionNS { namespace FractionNS {
int gcd(int p, int q) { int gcd(int p, int q) {
if(p < 0) p = -p;
if(q < 0) q = -q;
while(true) { while(true) {
if(p == 0) return q; if(p == 0) return q;
q %= p; q %= p;
if(q == 0) return p; if(q == 0) return p;
p %= q; p %= q;
} }
} }
int lcm(int p, int q) { int lcm(int p, int q) {
@ -17,32 +19,36 @@ namespace FractionNS {
return gcd != 0 ? (p / gcd * q) : 0; return gcd != 0 ? (p / gcd * q) : 0;
} }
int abs(int n) { void Fraction::reduce()
if(n < 0) return -n; {
return n; auto gcd = FractionNS::gcd(m_numerator, m_denominator);
} if((gcd == 1 && m_denominator >= 0) || gcd == 0) return;
if(gcd == 1 && m_denominator < 0) {
m_numerator = -m_numerator;
m_denominator = -m_denominator;
}
else if(m_denominator < 0)
{
m_numerator = -m_numerator / gcd;
m_denominator = -m_denominator / gcd;
} else {
m_numerator /= gcd;
m_denominator /= gcd;
}
}
Fraction::Fraction(int numerator, int denominator) Fraction::Fraction(int numerator, int denominator)
{ {
auto gcd = FractionNS::gcd(FractionNS::abs(numerator), FractionNS::abs(denominator)); if(denominator == 0) throw std::range_error("Tried to divide by 0.");
this->m_numerator = numerator;
if(denominator < 0) { this->m_denominator = denominator;
numerator *= -1; reduce();
denominator *= -1;
}
this->m_numerator = numerator / gcd;
this->m_denominator = denominator / gcd;
} }
Fraction::Fraction(int n) { Fraction::Fraction(const int n) {
this->m_numerator = n; this->m_numerator = n;
this->m_denominator = 1; this->m_denominator = 1;
} }
Fraction::Fraction(float n) {
// TODO
throw std::runtime_error("Not yet implemented");
}
Fraction::Fraction(const Fraction& n) { Fraction::Fraction(const Fraction& n) {
this->m_numerator = n.getNumerator(); this->m_numerator = n.getNumerator();
this->m_denominator = n.getDenominator(); this->m_denominator = n.getDenominator();
@ -52,11 +58,12 @@ namespace FractionNS {
int Fraction::getDenominator() const { return m_denominator; } int Fraction::getDenominator() const { return m_denominator; }
void Fraction::setNumerator(int numerator) { void Fraction::setNumerator(int numerator) {
auto gcd = std::__gcd(numerator, this->m_denominator); auto gcd = FractionNS::gcd(numerator, this->m_denominator);
this->m_numerator = numerator / gcd; this->m_numerator = numerator / gcd;
} }
void Fraction::setDenominator(int denominator) { void Fraction::setDenominator(int denominator) {
auto gcd = std::__gcd(this->m_numerator, denominator); if(denominator == 0) throw std::range_error("Tried to divide by 0.");
auto gcd = FractionNS::gcd(this->m_numerator, denominator);
this->m_denominator = denominator / gcd; this->m_denominator = denominator / gcd;
} }
@ -68,7 +75,7 @@ namespace FractionNS {
return (double(m_numerator) / double(m_denominator)) == n; return (double(m_numerator) / double(m_denominator)) == n;
} }
bool Fraction::operator==(const float n) const { bool Fraction::operator==(const float n) const {
return (double(m_numerator) / double(m_denominator)) == n; return (float(m_numerator) / float(m_denominator)) == n;
} }
bool Fraction::operator==(const double n) const { bool Fraction::operator==(const double n) const {
return (double(m_numerator) / double(m_denominator)) == n; return (double(m_numerator) / double(m_denominator)) == n;
@ -93,16 +100,66 @@ namespace FractionNS {
} }
Fraction& Fraction::operator+(const int n) const { Fraction& Fraction::operator+(const int n) const {
return Fraction(n) + *this; auto newNumerator = m_numerator + (n * m_denominator);
} return *new Fraction(newNumerator, m_denominator);
Fraction& Fraction::operator+(const float n) const {
return Fraction(n) + *this;
}
Fraction& Fraction::operator+(const double n) const {
return Fraction(n) + *this;
} }
Fraction& Fraction::operator+(const Fraction& other) const { Fraction& Fraction::operator+(const Fraction& other) const {
auto lcm = FractionNS::lcm(getDenominator(), other.getDenominator()); auto lcm = FractionNS::lcm(m_denominator, other.getDenominator());
return *new Fraction((getNumerator() + other.getNumerator()) * lcm, getDenominator() * lcm);
auto ownNumeratorPart = m_numerator * (lcm / m_denominator);
auto otherNumeratorPart = other.getNumerator() * (lcm / other.getDenominator());
return *new Fraction(ownNumeratorPart + otherNumeratorPart, lcm);
}
Fraction& Fraction::operator+=(const int other) {
this->m_numerator = m_numerator + (other * m_denominator);
reduce();
return *this;
}
Fraction& Fraction::operator+=(const Fraction& other) {
// Sanity check for Clang
// Not strictly necessary since setting to 0 is checked against in setDenominator and constructor(s).
if(other.getDenominator() == 0) return *this;
auto lcm = FractionNS::lcm(m_denominator, other.getDenominator());
auto ownNumeratorPart = m_numerator * (lcm / m_denominator);
auto otherNumeratorPart = other.getNumerator() * (lcm / other.getDenominator());
this->m_numerator = ownNumeratorPart + otherNumeratorPart;
this->m_denominator = lcm;
reduce();
return *this;
}
Fraction& Fraction::operator-(const int n) const {
auto newNumerator = m_numerator - (n * m_denominator);
return *new Fraction(newNumerator, m_denominator);
};
Fraction& Fraction::operator-(const Fraction& other) const {
auto lcm = FractionNS::lcm(m_denominator, other.getDenominator());
auto ownNumeratorPart = m_numerator * (lcm / m_denominator);
auto otherNumeratorPart = other.getNumerator() * (lcm / other.getDenominator());
return *new Fraction(ownNumeratorPart - otherNumeratorPart, lcm);
}
Fraction& Fraction::operator-=(const int n) {
auto newNumerator = m_numerator - (n * m_denominator);
return *new Fraction(newNumerator, m_denominator);
};
Fraction& Fraction::operator-=(const Fraction& other) {
// Sanity check for Clang
// Not strictly necessary since setting to 0 is checked against in setDenominator and constructor(s).
if(other.getDenominator() == 0) return *this;
auto lcm = FractionNS::lcm(m_denominator, other.getDenominator());
auto ownNumeratorPart = m_numerator * (lcm / m_denominator);
auto otherNumeratorPart = other.getNumerator() * (lcm / other.getDenominator());
return *new Fraction(ownNumeratorPart - otherNumeratorPart, lcm);
} }
} }

View file

@ -7,6 +7,7 @@ namespace FractionNS {
{ {
private: private:
int m_numerator, m_denominator; int m_numerator, m_denominator;
void reduce();
public: public:
Fraction(int, int); Fraction(int, int);
Fraction(int); Fraction(int);
@ -32,13 +33,15 @@ namespace FractionNS {
bool operator!=(const Fraction&) const; bool operator!=(const Fraction&) const;
Fraction& operator+(const int) const; Fraction& operator+(const int) const;
Fraction& operator+(const float) const;
Fraction& operator+(const double) const;
Fraction& operator+(const Fraction&) const; Fraction& operator+(const Fraction&) const;
Fraction& operator+=(const int); Fraction& operator+=(const int);
Fraction& operator+=(const float);
Fraction& operator+=(const double);
Fraction& operator+=(const Fraction&); Fraction& operator+=(const Fraction&);
Fraction& operator-(const int) const;
Fraction& operator-(const Fraction&) const;
Fraction& operator-=(const int);
Fraction& operator-=(const Fraction&);
}; };
} }

View file

@ -1,4 +1,5 @@
#include <QtTest> #include <QtTest>
#include <QDebug>
#include "fraction.hpp" #include "fraction.hpp"
@ -18,6 +19,7 @@ private slots:
void test_equivalence(); void test_equivalence();
void test_addition(); void test_addition();
void test_inequivalence(); void test_inequivalence();
void test_substraction();
}; };
FractionTest::FractionTest() FractionTest::FractionTest()
@ -95,11 +97,33 @@ void FractionTest::test_equivalence()
QCOMPARE(f3, -1); QCOMPARE(f3, -1);
QCOMPARE(f3, -1.0); QCOMPARE(f3, -1.0);
QCOMPARE(f3, -1.0f); QCOMPARE(f3, -1.0f);
Fraction f4 = Fraction(2, 3);
Fraction f5 = Fraction(-2, 3);
Fraction f6 = Fraction(2, -3);
Fraction f7 = Fraction(-2, -3);
QCOMPARE(f4, f7);
QCOMPARE(f5, f6);
QCOMPARE(f4, 2.0f/3.0f);
QCOMPARE(f4, 2.0/3.0);
QCOMPARE(f7, 2.0f/3.0f);
QCOMPARE(f7, 2.0/3.0);
QCOMPARE(f5, -2.0f/3.0f);
QCOMPARE(f5, -2.0/3.0);
QCOMPARE(f6, -2.0f/3.0f);
QCOMPARE(f6, -2.0/3.0);
} }
void FractionTest::test_inequivalence() { void FractionTest::test_inequivalence() {
Fraction f1 = Fraction(1, 1); Fraction f1 = Fraction(1, 1);
Fraction f2 = Fraction(-1, 1); Fraction f2 = Fraction(-1, 1);
Fraction f3 = Fraction(2, 3); Fraction f3 = Fraction(2, 3);
QVERIFY(f1 != f2); QVERIFY(f1 != f2);
QVERIFY(f2 != f3); QVERIFY(f2 != f3);
QVERIFY(f3 != f1); QVERIFY(f3 != f1);
@ -112,13 +136,39 @@ void FractionTest::test_inequivalence() {
void FractionTest::test_addition() void FractionTest::test_addition()
{ {
Fraction f1 = Fraction(1, 2); Fraction f1 = Fraction(1, 2);
QCOMPARE(f1 + 1.0f, 1.5f); QCOMPARE(f1 + 1, 1.5f);
f1 += 1.0f; QCOMPARE(f1, 0.5f);
f1 += 1;
QCOMPARE(f1, 1.5); QCOMPARE(f1, 1.5);
Fraction f2 = Fraction(1, 2); Fraction f2 = Fraction(1, 2);
QCOMPARE(f2 + 1.0f, 1.5f); QCOMPARE(f2 + 1, 1.5f);
QCOMPARE(f2, 1.0f); QCOMPARE(f2, 0.5f);
Fraction f3 = Fraction(-2, 9);
QCOMPARE(f3, -(2.0/9.0));
QCOMPARE(f3, -(2.0f/9.0f));
f3 += Fraction(2, 9);
QCOMPARE(f3, 0);
QCOMPARE(f3, 0.0);
QCOMPARE(f3, 0.0f);
}
void FractionTest::test_substraction() {
Fraction f1 = Fraction(11) - 10;
QCOMPARE(f1, 1);
Fraction f2 = Fraction(2, 3);
QCOMPARE(f1 - f2, Fraction(1, 3));
QCOMPARE(f2 - f1, Fraction(-1, 3));
Fraction f3 = Fraction(8, 3);
f3 -= Fraction(2, 3);
QCOMPARE(f3, Fraction(6, 3));
Fraction f4 = Fraction(9, 3);
f4 -= 3;
QCOMPARE(f4, 0);
} }
QTEST_APPLESS_MAIN(FractionTest) QTEST_APPLESS_MAIN(FractionTest)