-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formatted and added simple tests to temporal types
- Loading branch information
1 parent
867b4e0
commit 5f6fcda
Showing
12 changed files
with
248 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
**/target | ||
MobilityDB | ||
./MobilityDB | ||
bitacora.md | ||
Cargo.lock | ||
.vscode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ default = ["geos"] | |
|
||
[dev-dependencies] | ||
csv = "1.3.0" | ||
serial_test = "3.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,76 @@ | ||
pub mod tfloat; | ||
pub mod tint; | ||
pub mod tnumber; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::meos_initialize; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
fn instant_tint() { | ||
meos_initialize("UTC"); | ||
let string = "1@2018-01-01 08:00:00+00"; | ||
let result: tint::TInt = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Instant({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_tint() { | ||
meos_initialize("UTC"); | ||
let string = "[1@2018-01-01 08:00:00+00]"; | ||
let result: tint::TInt = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Sequence({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_set_tint() { | ||
meos_initialize("UTC"); | ||
let string = "{[1@2018-01-01 08:00:00+00]}"; | ||
let result: tint::TInt = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("SequenceSet({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn instant_tfloat() { | ||
meos_initialize("UTC"); | ||
let string = "1@2018-01-01 08:00:00+00"; | ||
let result: tfloat::TFloat = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Instant({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_tfloat() { | ||
meos_initialize("UTC"); | ||
let string = "[1@2018-01-01 08:00:00+00]"; | ||
let result: tfloat::TFloat = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Sequence({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_set_tfloat() { | ||
meos_initialize("UTC"); | ||
let string = "{[1@2018-01-01 08:00:00+00]}"; | ||
let result: tfloat::TFloat = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("SequenceSet({})", string.to_owned()) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,77 @@ | ||
pub mod tgeogpoint; | ||
pub mod tgeompoint; | ||
pub mod tpoint; | ||
|
||
#[cfg(test)] | ||
#[serial_test::serial] | ||
mod tests { | ||
use crate::meos_initialize; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
fn instant_tgeompoint() { | ||
meos_initialize("UTC"); | ||
let string = "POINT(0 0)@2018-01-01 08:00:00+00"; | ||
let result: tgeompoint::TGeomPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Instant({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn instant_tgeogpoint() { | ||
meos_initialize("UTC"); | ||
let string = "POINT(0 0)@2018-01-01 08:00:00+00"; | ||
let result: tgeogpoint::TGeogPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Instant({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_tgeompoint() { | ||
meos_initialize("UTC"); | ||
let string = "[POINT(0 0)@2018-01-01 08:00:00+00]"; | ||
let result: tgeompoint::TGeomPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Sequence({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_tgeogpoint() { | ||
meos_initialize("UTC"); | ||
let string = "[POINT(0 0)@2018-01-01 08:00:00+00]"; | ||
let result: tgeogpoint::TGeogPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("Sequence({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_set_tgeompoint() { | ||
meos_initialize("UTC"); | ||
let string = "{[POINT(0 0)@2018-01-01 08:00:00+00]}"; | ||
let result: tgeompoint::TGeomPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("SequenceSet({})", string.to_owned()) | ||
); | ||
} | ||
|
||
#[test] | ||
fn sequence_set_tgeogpoint() { | ||
meos_initialize("UTC"); | ||
let string = "{[POINT(0 0)@2018-01-01 08:00:00+00]}"; | ||
let result: tgeogpoint::TGeogPoint = string.parse().unwrap(); | ||
assert_eq!( | ||
format!("{result:?}"), | ||
format!("SequenceSet({})", string.to_owned()) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
use super::{temporal::Temporal, tsequence::TSequence}; | ||
|
||
pub trait TSequenceSet: Temporal { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters