add adder project (testing examples)
This commit is contained in:
parent
65f88596cb
commit
9fec8ed7f9
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@ -19,6 +19,7 @@
|
|||||||
<cargoProject FILE="$PROJECT_DIR$/largest_number/src/main.rs" />
|
<cargoProject FILE="$PROJECT_DIR$/largest_number/src/main.rs" />
|
||||||
<cargoProject FILE="$PROJECT_DIR$/generics/Cargo.toml" />
|
<cargoProject FILE="$PROJECT_DIR$/generics/Cargo.toml" />
|
||||||
<cargoProject FILE="$PROJECT_DIR$/lifetimes/Cargo.toml" />
|
<cargoProject FILE="$PROJECT_DIR$/lifetimes/Cargo.toml" />
|
||||||
|
<cargoProject FILE="$PROJECT_DIR$/adder/Cargo.toml" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ComposerJsonPluginSettings">
|
<component name="ComposerJsonPluginSettings">
|
||||||
<unboundedVersionInspectionSettings>
|
<unboundedVersionInspectionSettings>
|
||||||
|
5
.idea/rust.iml
generated
5
.idea/rust.iml
generated
@ -74,6 +74,11 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/lifetimes/examples" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/lifetimes/examples" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/lifetimes/tests" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/lifetimes/tests" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/lifetimes/benches" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/lifetimes/benches" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/adder/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/adder/examples" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/adder/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/adder/benches" isTestSource="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/adder/target" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/branches/target" />
|
<excludeFolder url="file://$MODULE_DIR$/branches/target" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/ctof/target" />
|
<excludeFolder url="file://$MODULE_DIR$/ctof/target" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/enums/target" />
|
<excludeFolder url="file://$MODULE_DIR$/enums/target" />
|
||||||
|
201
.idea/workspace.xml
generated
201
.idea/workspace.xml
generated
@ -14,19 +14,49 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lifetimes/src/main.rs">
|
<entry file="file://$PROJECT_DIR$/adder/src/lib.rs">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="912">
|
<state relative-caret-position="1025">
|
||||||
<caret line="57" lean-forward="true" selection-start-line="57" selection-end-line="57" />
|
<caret line="66" column="5" selection-start-line="66" selection-start-column="5" selection-end-line="66" selection-end-column="5" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#111#112#0" expanded="true" />
|
<element signature="e#251#252#0" expanded="true" />
|
||||||
<element signature="e#127#128#0" expanded="true" />
|
<element signature="e#263#264#0" expanded="true" />
|
||||||
|
<element signature="e#304#305#0" expanded="true" />
|
||||||
|
<element signature="e#338#339#0" expanded="true" />
|
||||||
|
<element signature="e#1036#1037#0" expanded="true" />
|
||||||
|
<element signature="e#1077#1078#0" expanded="true" />
|
||||||
|
<element signature="e#1119#1120#0" expanded="true" />
|
||||||
|
<element signature="e#1160#1161#0" expanded="true" />
|
||||||
|
<element signature="e#1196#1197#0" expanded="true" />
|
||||||
|
<element signature="e#1241#1242#0" expanded="true" />
|
||||||
|
<element signature="e#1191#1192#0" expanded="true" />
|
||||||
|
<element signature="e#1232#1233#0" expanded="true" />
|
||||||
|
<element signature="e#1520#1521#0" expanded="true" />
|
||||||
|
<element signature="e#1551#1552#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/adder/tests/integration_test.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="96">
|
||||||
|
<caret line="6" column="20" selection-start-line="6" selection-start-column="20" selection-end-line="6" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/adder/tests/common/mod.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="48">
|
||||||
|
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="FileTemplateManagerImpl">
|
<component name="FileTemplateManagerImpl">
|
||||||
@ -77,6 +107,9 @@
|
|||||||
<option value="$PROJECT_DIR$/generics/src/point.rs" />
|
<option value="$PROJECT_DIR$/generics/src/point.rs" />
|
||||||
<option value="$PROJECT_DIR$/generics/src/lib.rs" />
|
<option value="$PROJECT_DIR$/generics/src/lib.rs" />
|
||||||
<option value="$PROJECT_DIR$/lifetimes/src/main.rs" />
|
<option value="$PROJECT_DIR$/lifetimes/src/main.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/adder/src/lib.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/adder/tests/common/mod.rs" />
|
||||||
|
<option value="$PROJECT_DIR$/adder/tests/integration_test.rs" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@ -110,13 +143,20 @@
|
|||||||
<path>
|
<path>
|
||||||
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
|
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
|
||||||
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
|
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
|
||||||
<item name="lifetimes" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
<item name="adder" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
|
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
|
||||||
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
|
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
|
||||||
<item name="lifetimes" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
<item name="adder" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
<item name="src" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
<item name="tests" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="rust" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
|
||||||
|
<item name="rust" type="2674bda8:ScopeViewTreeModel$GroupNode" />
|
||||||
|
<item name="adder" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
|
<item name="tests" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
|
<item name="common" type="9f88c78c:ScopeViewTreeModel$FileNode" />
|
||||||
</path>
|
</path>
|
||||||
</expand>
|
</expand>
|
||||||
<select />
|
<select />
|
||||||
@ -149,7 +189,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
|
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
|
||||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548960808738" />
|
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1548965323798" />
|
||||||
<property name="javascript.nodejs.core.library.configured.version" value="7.1.0" />
|
<property name="javascript.nodejs.core.library.configured.version" value="7.1.0" />
|
||||||
<property name="js.eslint.eslintPackage" value="$USER_HOME$/.yarn-config/global/node_modules/.bin/eslint" />
|
<property name="js.eslint.eslintPackage" value="$USER_HOME$/.yarn-config/global/node_modules/.bin/eslint" />
|
||||||
<property name="js.eslint.nodeInterpreter" value="project" />
|
<property name="js.eslint.nodeInterpreter" value="project" />
|
||||||
@ -177,7 +217,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Cargo Command.Run lifetimes">
|
<component name="RunManager" selected="Cargo Command.Test lib::tests">
|
||||||
<configuration name="<template>" type="TestNG" default="true" selected="false">
|
<configuration name="<template>" type="TestNG" default="true" selected="false">
|
||||||
<option name="MAIN_CLASS_NAME" />
|
<option name="MAIN_CLASS_NAME" />
|
||||||
<option name="VM_PARAMETERS" value="-ea" />
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
@ -196,36 +236,6 @@
|
|||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="Run errors" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
|
||||||
<option name="channel" value="DEFAULT" />
|
|
||||||
<option name="command" value="run --package errors --bin errors" />
|
|
||||||
<option name="allFeatures" value="false" />
|
|
||||||
<option name="nocapture" value="false" />
|
|
||||||
<option name="backtrace" value="SHORT" />
|
|
||||||
<option name="workingDirectory" value="file://$PROJECT_DIR$/errors" />
|
|
||||||
<envs />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="Run generics" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
|
||||||
<option name="channel" value="DEFAULT" />
|
|
||||||
<option name="command" value="run --package generics --bin generics" />
|
|
||||||
<option name="allFeatures" value="false" />
|
|
||||||
<option name="nocapture" value="false" />
|
|
||||||
<option name="backtrace" value="SHORT" />
|
|
||||||
<option name="workingDirectory" value="file://$PROJECT_DIR$/generics" />
|
|
||||||
<envs />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="Run largest_number" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
|
||||||
<option name="channel" value="DEFAULT" />
|
|
||||||
<option name="command" value="run --package largest_number --bin largest_number" />
|
|
||||||
<option name="allFeatures" value="false" />
|
|
||||||
<option name="nocapture" value="false" />
|
|
||||||
<option name="backtrace" value="SHORT" />
|
|
||||||
<option name="workingDirectory" value="file://$PROJECT_DIR$/largest_number/src" />
|
|
||||||
<envs />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="Run lifetimes" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
<configuration name="Run lifetimes" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
<option name="channel" value="DEFAULT" />
|
<option name="channel" value="DEFAULT" />
|
||||||
<option name="command" value="run --package lifetimes --bin lifetimes" />
|
<option name="command" value="run --package lifetimes --bin lifetimes" />
|
||||||
@ -236,13 +246,43 @@
|
|||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="Run modules" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
<configuration name="Test lib::tests" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
<option name="channel" value="DEFAULT" />
|
<option name="channel" value="DEFAULT" />
|
||||||
<option name="command" value="run --package modules --bin modules" />
|
<option name="command" value="test --package adder --lib tests" />
|
||||||
<option name="allFeatures" value="false" />
|
<option name="allFeatures" value="false" />
|
||||||
<option name="nocapture" value="false" />
|
<option name="nocapture" value="false" />
|
||||||
<option name="backtrace" value="SHORT" />
|
<option name="backtrace" value="SHORT" />
|
||||||
<option name="workingDirectory" value="file://$PROJECT_DIR$/modules" />
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/adder" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="Test tests::greater_than_100" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
|
<option name="channel" value="DEFAULT" />
|
||||||
|
<option name="command" value="test --package adder --lib tests::greater_than_100 -- --exact" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/adder" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="Test tests::greeting_contains_name" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
|
<option name="channel" value="DEFAULT" />
|
||||||
|
<option name="command" value="test --package adder --lib tests::greeting_contains_name -- --exact" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/adder" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="Test tests::it_works" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||||
|
<option name="channel" value="DEFAULT" />
|
||||||
|
<option name="command" value="test --package adder --lib tests::it_works -- --exact" />
|
||||||
|
<option name="allFeatures" value="false" />
|
||||||
|
<option name="nocapture" value="false" />
|
||||||
|
<option name="backtrace" value="SHORT" />
|
||||||
|
<option name="workingDirectory" value="file://$PROJECT_DIR$/adder" />
|
||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -255,20 +295,40 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Cargo Command.Test lib::tests" />
|
||||||
|
<item itemvalue="Cargo Command.Test tests::greater_than_100" />
|
||||||
|
<item itemvalue="Cargo Command.Test tests::greeting_contains_name" />
|
||||||
|
<item itemvalue="Cargo Command.Test tests::it_works" />
|
||||||
<item itemvalue="Cargo Command.Run lifetimes" />
|
<item itemvalue="Cargo Command.Run lifetimes" />
|
||||||
<item itemvalue="Cargo Command.Run generics" />
|
|
||||||
<item itemvalue="Cargo Command.Run largest_number" />
|
|
||||||
<item itemvalue="Cargo Command.Run errors" />
|
|
||||||
<item itemvalue="Cargo Command.Run modules" />
|
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="TestHistory">
|
||||||
|
<history-entry file="Test_tests__it_works - 2019.01.31 at 14h 06m 37s.xml">
|
||||||
|
<configuration name="Test tests::it_works" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="Test_tests__greeting_contains_name - 2019.01.31 at 14h 18m 57s.xml">
|
||||||
|
<configuration name="Test tests::greeting_contains_name" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="Test_tests__greeting_contains_name - 2019.01.31 at 14h 19m 31s.xml">
|
||||||
|
<configuration name="Test tests::greeting_contains_name" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="Test_lib__tests - 2019.01.31 at 14h 20m 55s.xml">
|
||||||
|
<configuration name="Test lib::tests" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="Test_tests__greater_than_100 - 2019.01.31 at 14h 21m 34s.xml">
|
||||||
|
<configuration name="Test tests::greater_than_100" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="Test_lib__tests - 2019.01.31 at 14h 59m 57s.xml">
|
||||||
|
<configuration name="Test lib::tests" configurationId="CargoCommandRunConfiguration" />
|
||||||
|
</history-entry>
|
||||||
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="1680" y="-410" width="1050" height="1657" extended-state="6" />
|
<frame x="1680" y="-410" width="1050" height="1657" extended-state="6" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.49724266" visible="true" weight="0.26141885" />
|
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49663138" visible="true" weight="0.26141885" />
|
||||||
<window_info id="Structure" order="1" sideWeight="0.5027574" side_tool="true" visible="true" weight="0.26141885" />
|
<window_info id="Structure" order="1" sideWeight="0.5033686" side_tool="true" visible="true" weight="0.26141885" />
|
||||||
<window_info id="Image Layers" order="2" />
|
<window_info id="Image Layers" order="2" />
|
||||||
<window_info id="Designer" order="3" />
|
<window_info id="Designer" order="3" />
|
||||||
<window_info id="Capture Tool" order="4" />
|
<window_info id="Capture Tool" order="4" />
|
||||||
@ -276,7 +336,7 @@
|
|||||||
<window_info id="Cargo" order="6" sideWeight="0.49791494" weight="0.3286119" />
|
<window_info id="Cargo" order="6" sideWeight="0.49791494" weight="0.3286119" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32979318" />
|
<window_info anchor="bottom" id="Find" order="1" weight="0.32979318" />
|
||||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.29761136" />
|
<window_info anchor="bottom" id="Run" order="2" weight="0.29761136" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
@ -284,7 +344,7 @@
|
|||||||
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
||||||
<window_info anchor="bottom" id="Version Control" order="8" />
|
<window_info anchor="bottom" id="Version Control" order="8" />
|
||||||
<window_info anchor="bottom" id="Inspection Results" order="9" weight="0.32979318" />
|
<window_info anchor="bottom" id="Inspection Results" order="9" weight="0.32979318" />
|
||||||
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32924467" />
|
<window_info anchor="bottom" id="Terminal" order="10" visible="true" weight="0.32924467" />
|
||||||
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
|
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
|
||||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||||
@ -529,5 +589,42 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/adder/src/lib.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="1025">
|
||||||
|
<caret line="66" column="5" selection-start-line="66" selection-start-column="5" selection-end-line="66" selection-end-column="5" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#251#252#0" expanded="true" />
|
||||||
|
<element signature="e#263#264#0" expanded="true" />
|
||||||
|
<element signature="e#304#305#0" expanded="true" />
|
||||||
|
<element signature="e#338#339#0" expanded="true" />
|
||||||
|
<element signature="e#1036#1037#0" expanded="true" />
|
||||||
|
<element signature="e#1077#1078#0" expanded="true" />
|
||||||
|
<element signature="e#1119#1120#0" expanded="true" />
|
||||||
|
<element signature="e#1160#1161#0" expanded="true" />
|
||||||
|
<element signature="e#1196#1197#0" expanded="true" />
|
||||||
|
<element signature="e#1241#1242#0" expanded="true" />
|
||||||
|
<element signature="e#1191#1192#0" expanded="true" />
|
||||||
|
<element signature="e#1232#1233#0" expanded="true" />
|
||||||
|
<element signature="e#1520#1521#0" expanded="true" />
|
||||||
|
<element signature="e#1551#1552#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/adder/tests/common/mod.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="48">
|
||||||
|
<caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/adder/tests/integration_test.rs">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="96">
|
||||||
|
<caret line="6" column="20" selection-start-line="6" selection-start-column="20" selection-end-line="6" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
7
adder/Cargo.toml
Normal file
7
adder/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "adder"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Timothy Warren <twarren@nabancard.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
104
adder/src/lib.rs
Normal file
104
adder/src/lib.rs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Rectangle {
|
||||||
|
length: u32,
|
||||||
|
width: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Rectangle {
|
||||||
|
pub fn can_hold(&self, other: &Rectangle) -> bool {
|
||||||
|
self.length > other.length && self.width > other.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_two(a: i32) -> i32 {
|
||||||
|
a + 2
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn greeting(name: &str) -> String {
|
||||||
|
format!("Hello, {}!", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Guess {
|
||||||
|
value: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Guess {
|
||||||
|
pub fn new(value: i32) -> Guess {
|
||||||
|
if value < 1 {
|
||||||
|
panic!("Guess value must be greater than or equal to 1, got {}.",
|
||||||
|
value);
|
||||||
|
} else if value > 100 {
|
||||||
|
panic!("Guess value must be less than or equal to 100, got {}.",
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Guess {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_works() -> Result<(), String> {
|
||||||
|
if 2 + 2 == 4 {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(String::from("two plus two does not equal four"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_two_and_two() {
|
||||||
|
assert_eq!(4, add_two(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_three_and_two() {
|
||||||
|
assert_eq!(5, add_two(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn one_hundred() {
|
||||||
|
assert_eq!(102, add_two(100));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn larger_can_hold_smaller() {
|
||||||
|
let larger = Rectangle { length: 8, width: 7 };
|
||||||
|
let smaller = Rectangle { length: 5, width: 1 };
|
||||||
|
|
||||||
|
assert!(larger.can_hold(&smaller));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn smaller_cannot_hold_larger() {
|
||||||
|
let larger = Rectangle { length: 8, width: 7 };
|
||||||
|
let smaller = Rectangle { length: 5, width: 1 };
|
||||||
|
|
||||||
|
assert!(!smaller.can_hold(&larger));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_adds_two() {
|
||||||
|
assert_eq!(4, add_two(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn greeting_contains_name() {
|
||||||
|
let result = greeting("Carol");
|
||||||
|
assert!(
|
||||||
|
result.contains("Carol"),
|
||||||
|
"Greeting did not contain name, value was `{}`", result
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic(expected = "Guess value must be less than or equal to 100")]
|
||||||
|
fn greater_than_100() {
|
||||||
|
Guess::new(200);
|
||||||
|
}
|
||||||
|
}
|
3
adder/tests/common/mod.rs
Normal file
3
adder/tests/common/mod.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub fn setup() {
|
||||||
|
// setup code specific to your library's tests would go here
|
||||||
|
}
|
9
adder/tests/integration_test.rs
Normal file
9
adder/tests/integration_test.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use adder;
|
||||||
|
|
||||||
|
mod common;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_adds_two() {
|
||||||
|
common::setup();
|
||||||
|
assert_eq!(4, adder::add_two(2));
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user