Compare commits
merge into: jake:master
jake:andy/add-patch-log-dir
jake:andy/clamp-mag-feed
jake:andy/map-objects
jake:andy/update-rust
jake:expsteal
jake:fuckin_andy_making_me_do_this_now
jake:kill_counters
jake:map_objects
jake:master
jake:morfin/test
jake:move_stuff_to_libpso
jake:pbs
jake:presents
jake:sendgc
jake:set_char_exp
jake:teams
jake:techs
jake:traps
jake:unitxt
pull from: jake:sendgc
jake:andy/add-patch-log-dir
jake:andy/clamp-mag-feed
jake:andy/map-objects
jake:andy/update-rust
jake:expsteal
jake:fuckin_andy_making_me_do_this_now
jake:kill_counters
jake:map_objects
jake:master
jake:morfin/test
jake:move_stuff_to_libpso
jake:pbs
jake:presents
jake:sendgc
jake:set_char_exp
jake:teams
jake:techs
jake:traps
jake:unitxt
5 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
andy | ee7382e8e4 |
pr changes
|
2 years ago |
andy | 5898a8120a | ci pls work | 2 years ago |
andy | f2c4094b8f |
andy vs clippy round 8
|
2 years ago |
andy | f3294dfce8 |
a test i guess
|
2 years ago |
andy | 24fdd705c5 |
f is for friends who do stuff together
|
2 years ago |
10 changed files with 121 additions and 18 deletions
-
2Cargo.lock
-
2Cargo.toml
-
27src/entity/account.rs
-
4src/entity/gateway/entitygateway.rs
-
23src/entity/gateway/inmemory.rs
-
3src/entity/gateway/postgres/postgres.rs
-
4src/login/character.rs
-
14src/ship/packet/handler/communication.rs
-
5src/ship/ship.rs
-
55tests/test_communication.rs
@ -0,0 +1,55 @@ |
|||
use elseware::common::serverstate::{ClientId, ServerState};
|
|||
use elseware::entity::gateway::{EntityGateway, InMemoryGateway};
|
|||
use elseware::ship::ship::{ShipServerState, RecvShipPacket};
|
|||
use libpso::packet::ship::*;
|
|||
|
|||
#[path = "common.rs"]
|
|||
mod common;
|
|||
use common::*;
|
|||
|
|||
#[async_std::test]
|
|||
async fn test_guildcard_add_friend() {
|
|||
let mut entity_gateway = InMemoryGateway::default();
|
|||
let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|||
|
|||
let mut ship = Box::new(ShipServerState::builder()
|
|||
.gateway(entity_gateway.clone())
|
|||
.build());
|
|||
|
|||
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|||
join_lobby(&mut ship, ClientId(1)).await;
|
|||
|
|||
// Accept friend request from "Test Char 2"
|
|||
ship.handle(ClientId(1), &RecvShipPacket::GuildcardAccept(GuildcardAccept {
|
|||
id: 2,
|
|||
name: [84, 101, 115, 116, 32, 67, 104, 97, 114, 32, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|||
team: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|||
desc: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|||
one: 1,
|
|||
language: 0,
|
|||
section_id: 0,
|
|||
class: 0,
|
|||
})).await.unwrap().for_each(drop);
|
|||
|
|||
let friendlist = entity_gateway.get_guild_card_data_by_user(&user1).await.unwrap();
|
|||
|
|||
assert!(friendlist.guildcard_data.friends[0].name == [84, 101, 115, 116, 32, 67, 104, 97, 114, 32, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|||
}
|
|||
|
|||
|
|||
/*
|
|||
TODO: actually write these tests at some point. also add a test for transmute/repr(C)?
|
|||
|
|||
#[async_std::test]
|
|||
async fn test_guildcard_block_rival() {}
|
|||
|
|||
#[async_std::test]
|
|||
async fn test_guildcard_write_comment() {}
|
|||
|
|||
#[async_std::test]
|
|||
async fn test_player_chat() {}
|
|||
|
|||
#[async_std::test]
|
|||
async fn test_update_infoboard() {}
|
|||
|
|||
*/
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue