Skip to content

Commit

Permalink
Rustfmt code
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelbuesing committed May 15, 2019
1 parent 20c7808 commit 3814bb5
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 76 deletions.
26 changes: 13 additions & 13 deletions examples/file_parser.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

extern crate clap;

use clap::{Arg, App};
use can_dbc;
use clap::{App, Arg};
use nom;
use nom::verbose_errors;

use std::cmp;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::cmp;

fn main() -> io::Result<()> {

let matches = App::new("DBC Parser")
.version("1.0")
.arg(Arg::with_name("input")
.short("i")
.long("input")
.value_name("FILE")
.help("DBC file path")
.takes_value(true))
.get_matches();
.version("1.0")
.arg(
Arg::with_name("input")
.short("i")
.long("input")
.value_name("FILE")
.help("DBC file path")
.takes_value(true),
)
.get_matches();
let path = matches.value_of("input").unwrap_or("./examples/sample.dbc");

let mut f = File::open(path)?;
Expand All @@ -46,4 +46,4 @@ fn main() -> io::Result<()> {
}

Ok(())
}
}
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,18 @@ SIG_VALTYPE_ 2000 Signal_8 : 1;
let dbc_content = DBC::from_slice(SAMPLE_DBC).expect("Failed to parse DBC");
let extended_value_type =
dbc_content.extended_value_type_for_signal(&MessageId(2000), "Signal_8");
assert_eq!(extended_value_type, Some(&SignalExtendedValueType::IEEEfloat32Bit));
assert_eq!(
extended_value_type,
Some(&SignalExtendedValueType::IEEEfloat32Bit)
);
}

#[test]
#[test]
fn lookup_extended_value_type_for_signal_none_when_missing() {
let dbc_content = DBC::from_slice(SAMPLE_DBC).expect("Failed to parse DBC");
let extended_value_type =
dbc_content.extended_value_type_for_signal(&MessageId(2000), "Signal_1");
assert_eq!(extended_value_type , None);
assert_eq!(extended_value_type, None);
}
}

Expand Down
Loading

0 comments on commit 3814bb5

Please sign in to comment.