2 Commits

Author SHA1 Message Date
Johannes Wendel
8b76902f63 Current state 2025-01-20 20:04:11 +01:00
Johannes Wendel
9887ac97ac Add integration test 2024-12-30 20:04:16 +01:00
3 changed files with 38 additions and 1 deletions

1
src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod flutr;

View File

@@ -5,7 +5,6 @@ use image::ImageReader;
use clap::Parser;
mod flutr;
mod pixelmsgs;
use flutr::FlutR;

37
tests/integration.rs Normal file
View File

@@ -0,0 +1,37 @@
use std::{
net::TcpListener,
io::Read,
thread,
};
use flutr::FlutR;
fn receive_bytes() -> [u8; 128]{
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
let mut stream = listener.accept().unwrap().0;
let mut buf: [u8; 128] = [0; 128];
stream.read(&mut buf).unwrap();
return buf;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let receive_thread = thread::spawn(move || {return receive_bytes();});
let flutr_server = Flutr::new();
let buf = receive_thread.join();
for x in buf.unwrap() {
print!("{x}, ");
}
}
}