Skip to content

Commit 44a04c9

Browse files
authored
Remove SUPPORTED_VERSION minimal logic (#335)
* Remove maximal SUPPORTED_VERSION logic --------- Signed-off-by: Guillaume W. Bres <[email protected]>
1 parent e6163da commit 44a04c9

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

src/header/parsing.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,6 @@ impl Header {
261261
*/
262262
let vers = vers.trim();
263263
version = Version::from_str(vers).or(Err(ParsingError::VersionParsing))?;
264-
265-
if !version.is_supported() {
266-
return Err(ParsingError::NonSupportedVersion);
267-
}
268264
} else if marker.contains("PGM / RUN BY / DATE") {
269265
let (pgm, rem) = line.split_at(20);
270266
let pgm = pgm.trim();

src/version.rs

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! `RINEX` revision description
22
use crate::prelude::ParsingError;
33

4-
/// Current `RINEX` version supported to this day
5-
pub const SUPPORTED_VERSION: Version = Version { major: 4, minor: 2 };
6-
74
/// Version is used to describe RINEX standards revisions.
85
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
96
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
@@ -17,7 +14,7 @@ pub struct Version {
1714
impl Default for Version {
1815
/// Builds a default `Version` object
1916
fn default() -> Self {
20-
SUPPORTED_VERSION
17+
Version::new(4, 0)
2118
}
2219
}
2320

@@ -106,32 +103,19 @@ impl std::str::FromStr for Version {
106103
}
107104

108105
impl Version {
109-
/// Builds a new `Version` object
106+
/// Builds a new [Version]
110107
pub fn new(major: u8, minor: u8) -> Self {
111108
Self { major, minor }
112109
}
113-
/// Returns true if this version is supported
114-
pub fn is_supported(&self) -> bool {
115-
if self.major < SUPPORTED_VERSION.major {
116-
true
117-
} else if self.major == SUPPORTED_VERSION.major {
118-
self.minor <= SUPPORTED_VERSION.minor
119-
} else {
120-
false
121-
}
122-
}
123110
}
124111

125112
#[cfg(test)]
126113
mod test {
127114
use super::*;
128115
use std::str::FromStr;
116+
129117
#[test]
130118
fn version() {
131-
let version = Version::default();
132-
assert_eq!(version.major, SUPPORTED_VERSION.major);
133-
assert_eq!(version.minor, SUPPORTED_VERSION.minor);
134-
135119
let version = Version::from_str("1");
136120
assert!(version.is_ok());
137121
let version = version.unwrap();
@@ -153,25 +137,15 @@ mod test {
153137
let version = Version::from_str("a.b");
154138
assert!(version.is_err());
155139
}
156-
#[test]
157-
fn supported_version() {
158-
let version = Version::default();
159-
assert!(version.is_supported());
160-
let version = SUPPORTED_VERSION;
161-
assert!(version.is_supported());
162-
}
163-
#[test]
164-
fn non_supported_version() {
165-
let version = Version::new(5, 0);
166-
assert!(!version.is_supported());
167-
}
140+
168141
#[test]
169142
fn version_comparison() {
170143
let v_a = Version::from_str("1.2").unwrap();
171144
let v_b = Version::from_str("3.02").unwrap();
172145
assert!(v_b > v_a);
173146
assert!(v_b != v_a);
174147
}
148+
175149
#[test]
176150
fn version_arithmetics() {
177151
let version = Version::new(3, 2);

0 commit comments

Comments
 (0)