An unofficial collection of APIs used in FreeJam games and mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clre_server.rs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #[cfg(feature = "cardlife")]
  2. use libfj::cardlife;
  3. #[cfg(feature = "cardlife")]
  4. #[test]
  5. fn clre_server_init() -> Result<(), ()> {
  6. assert!(cardlife::CLreServer::new("http://localhost:5030").is_ok());
  7. Ok(())
  8. }
  9. /*
  10. #[cfg(feature = "cardlife")]
  11. #[tokio::test]
  12. async fn clre_server_game() -> Result<(), ()> {
  13. let server = cardlife::CLreServer::new("http://localhost:5030").unwrap();
  14. let result = server.game_info().await;
  15. assert!(result.is_ok());
  16. let game_info = result.unwrap();
  17. assert_eq!(game_info.admin_password, "");
  18. assert_eq!(game_info.game_host_type, 1);
  19. println!("GameInfo.to_string() -> `{}`", game_info.to_string());
  20. Ok(())
  21. }
  22. #[cfg(feature = "cardlife")]
  23. #[tokio::test]
  24. async fn clre_server_status() -> Result<(), ()> {
  25. let server = cardlife::CLreServer::new("http://localhost:5030").unwrap();
  26. let result = server.status_info().await;
  27. assert!(result.is_ok());
  28. let status_info = result.unwrap();
  29. assert_eq!(status_info.status, "Online");
  30. assert_eq!(status_info.max_players, 10);
  31. assert_eq!(status_info.player_count, status_info.online_players.len());
  32. if status_info.online_players.len() != 0 {
  33. for player in &status_info.online_players {
  34. assert_ne!(player.name, "");
  35. assert_ne!(player.id, "");
  36. assert!(!player.is_dev);
  37. println!("PlayerStatusInfo.to_string() -> `{}`", player.to_string());
  38. }
  39. }
  40. Ok(())
  41. }*/