add chunk_type_test
use super::*;
+///////////////////////////////////////////////////////////////////
+//chunk_type_test
+///////////////////////////////////////////////////////////////////
+use super::chunk_type::*;
+
+#[test]
+fn test_chunk_type_string() -> Result<(), Error> {
+ let tests = vec![
+ (ChunkType::PayloadData, "DATA"),
+ (ChunkType::Init, "INIT"),
+ (ChunkType::InitAck, "INIT-ACK"),
+ (ChunkType::Sack, "SACK"),
+ (ChunkType::Heartbeat, "HEARTBEAT"),
+ (ChunkType::HeartbeatAck, "HEARTBEAT-ACK"),
+ (ChunkType::Abort, "ABORT"),
+ (ChunkType::Shutdown, "SHUTDOWN"),
+ (ChunkType::ShutdownAck, "SHUTDOWN-ACK"),
+ (ChunkType::Error, "ERROR"),
+ (ChunkType::CookieEcho, "COOKIE-ECHO"),
+ (ChunkType::CookieAck, "COOKIE-ACK"),
+ (ChunkType::Cwr, "ECNE"),
+ (ChunkType::ShutdownComplete, "SHUTDOWN-COMPLETE"),
+ (ChunkType::Reconfig, "RECONFIG"),
+ (ChunkType::ForwardTsn, "FORWARD-TSN"),
+ (ChunkType::Unknown, "Unknown ChunkType"),
+ ];
+
+ for (ct, expected) in tests {
+ assert_eq!(
+ ct.to_string(),
+ expected,
+ "failed to stringify chunkType {}, expected {}",
+ ct,
+ expected
+ );
+ }
+
+ Ok(())
+}
+
///////////////////////////////////////////////////////////////////
//chunk_abort_test
///////////////////////////////////////////////////////////////////
@@ -65,7 +105,6 @@ fn test_abort_chunk_many_error_causes() -> Result<(), Error> {
//chunk_error_test
///////////////////////////////////////////////////////////////////
use super::chunk_error::*;
-use super::chunk_type::*;
use bytes::BufMut;
use lazy_static::lazy_static;
