First commit
commit
1c23cffc73
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/temp-converter.iml" filepath="$PROJECT_DIR$/.idea/temp-converter.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="CPP_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
|
||||
<generated />
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="CargoProjects">
|
||||
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="a41bed0d-bee3-4326-80a4-bca6742f0d19" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="zf5qvhsf" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1fBXGUi3dGZ1f1VZpsk6AzRY08I" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="cf.first.check.clang-format" value="false" />
|
||||
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
|
||||
</component>
|
||||
<component name="RustProjectSettings">
|
||||
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="a41bed0d-bee3-4326-80a4-bca6742f0d19" name="Default Changelist" comment="" />
|
||||
<created>1595692363236</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1595692363236</updated>
|
||||
<workItem from="1595692364684" duration="644000" />
|
||||
<workItem from="1595766754852" duration="1006000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="429" y="-1430" width="670" height="676" key="search.everywhere.popup" timestamp="1595767460641">
|
||||
<screen x="-916" y="-1867" width="3360" height="1867" />
|
||||
</state>
|
||||
<state x="429" y="-1430" width="670" height="676" key="search.everywhere.popup/-916.-1867.3360.1867/0.23.1792.1024@-916.-1867.3360.1867" timestamp="1595767460641" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,5 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "temp-converter"
|
||||
version = "0.1.0"
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "temp-converter"
|
||||
version = "0.1.0"
|
||||
authors = ["jaketothepast <windlejacob12@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1,43 @@
|
|||
use std::env;
|
||||
|
||||
fn main() {
|
||||
// Collect our arguments into a vector
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let temp: f64 = args[1].parse().expect("Number");
|
||||
let specifier: char = args[2].parse().expect("not a char");
|
||||
|
||||
let res = match specifier {
|
||||
'c' => to_fahrenheit(temp),
|
||||
'f' => to_celsius(temp),
|
||||
_ => panic!("Not ok")
|
||||
};
|
||||
|
||||
println!("Converted temp is: {:?}", res);
|
||||
}
|
||||
|
||||
fn to_celsius(temp: f64) -> f64 {
|
||||
(temp - 32.) * (5.0 / 9.0)
|
||||
}
|
||||
|
||||
fn to_fahrenheit(temp: f64) -> f64 {
|
||||
temp / 5.0 * 9.0 + 32.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_f_to_c() {
|
||||
let mynum = 32.;
|
||||
let expected = 0.;
|
||||
|
||||
assert_eq!(to_celsius(mynum), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_f_to_c_boiling() {
|
||||
assert_eq!(to_celsius(212.), 100.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_c_to_f() {
|
||||
assert_eq!(to_fahrenheit(100.), 212.);
|
||||
assert_eq!(to_fahrenheit(0.), 32.);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"rustc_fingerprint":14440799327868941031,"outputs":{"1164083562126845933":["rustc 1.44.1 (c7087fe00 2020-06-17)\nbinary: rustc\ncommit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7\ncommit-date: 2020-06-17\nhost: x86_64-apple-darwin\nrelease: 1.44.1\nLLVM version: 9.0\n",""],"4476964694761187371":["___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/jacobwindle/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n",""]},"successes":{}}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
This file has an mtime of when this was started.
|
|
@ -0,0 +1 @@
|
|||
8b20d2ae7eedad4a
|
|
@ -0,0 +1 @@
|
|||
{"rustc":7151530983591731262,"features":"[]","target":12629718435023892152,"profile":8248545651247322450,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/temp-converter-541c74692ae718de/dep-test-bin-temp_converter-541c74692ae718de"}}],"rustflags":[],"metadata":15517608058969423672}
|
|
@ -0,0 +1 @@
|
|||
599ab1f4c4ed4d24
|
|
@ -0,0 +1 @@
|
|||
{"rustc":7151530983591731262,"features":"[]","target":12629718435023892152,"profile":14996655781355331481,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/temp-converter-a7d226e9efc0a103/dep-bin-temp-converter"}}],"rustflags":[],"metadata":15517608058969423672}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
This file has an mtime of when this was started.
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
/Users/jacobwindle/CLionProjects/temp-converter/target/debug/deps/temp_converter-541c74692ae718de: src/main.rs
|
||||
|
||||
/Users/jacobwindle/CLionProjects/temp-converter/target/debug/deps/temp_converter-541c74692ae718de.d: src/main.rs
|
||||
|
||||
src/main.rs:
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.temp_converter-541c74692ae718de</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
/Users/jacobwindle/CLionProjects/temp-converter/target/debug/deps/temp_converter: src/main.rs
|
||||
|
||||
/Users/jacobwindle/CLionProjects/temp-converter/target/debug/deps/temp_converter.d: src/main.rs
|
||||
|
||||
src/main.rs:
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.temp_converter</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
/Users/jacobwindle/CLionProjects/temp-converter/target/debug/temp-converter: /Users/jacobwindle/CLionProjects/temp-converter/src/main.rs
|
Loading…
Reference in New Issue