mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-20 00:56:30 +00:00
closedcaption: Move duplicated test into a single place
This commit is contained in:
parent
82c8a7b7e8
commit
cbe54c0827
3 changed files with 58 additions and 106 deletions
|
@ -388,59 +388,6 @@ impl MccParser {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_timecode() {
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13;14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: true
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14abcd".as_ref()),
|
||||
Ok((
|
||||
b"abcd".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"abcd11:12:13:14".as_ref()),
|
||||
Err(nom::Err::Error(nom::error::Error::new(
|
||||
b"abcd11:12:13:14".as_ref(),
|
||||
nom::error::ErrorKind::MapRes
|
||||
))),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_header() {
|
||||
assert_eq!(
|
||||
|
|
|
@ -88,3 +88,61 @@ pub fn end_of_line(s: &[u8]) -> IResult<&[u8], ()> {
|
|||
|
||||
map(pair(opt(alt((tag("\r\n"), tag("\n")))), eof), |_| ())(s)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_timecode() {
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13;14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: true
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14abcd".as_ref()),
|
||||
Ok((
|
||||
b"abcd".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"abcd11:12:13:14".as_ref()),
|
||||
Err(nom::Err::Error(nom::error::Error::new(
|
||||
b"abcd11:12:13:14".as_ref(),
|
||||
nom::error::ErrorKind::MapRes
|
||||
))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,59 +184,6 @@ impl SccParser {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_timecode() {
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13;14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: true
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14".as_ref()),
|
||||
Ok((
|
||||
b"".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"11:12:13:14abcd".as_ref()),
|
||||
Ok((
|
||||
b"abcd".as_ref(),
|
||||
TimeCode {
|
||||
hours: 11,
|
||||
minutes: 12,
|
||||
seconds: 13,
|
||||
frames: 14,
|
||||
drop_frame: false
|
||||
},
|
||||
))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
timecode(b"abcd11:12:13:14".as_ref()),
|
||||
Err(nom::Err::Error(nom::error::Error::new(
|
||||
b"abcd11:12:13:14".as_ref(),
|
||||
nom::error::ErrorKind::MapRes
|
||||
))),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_header() {
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in a new issue