From 6cdea283b190de0023dc7fd9e66e7401489687f6 Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Tue, 14 Jun 2011 09:34:18 +0200 Subject: [PATCH] add tests --- CSharpTranslator/tests/Tester/Enums/Consts.cs | 15 + .../tests/Tester/Enums/PacketTester.cs | 396 ++++++++++++++++++ .../tests/Tester/MiscSyntax/MiscSyntax.cs | 34 ++ CSharpTranslator/tests/Tester/Tester.csproj | 5 + 4 files changed, 450 insertions(+) create mode 100644 CSharpTranslator/tests/Tester/Enums/Consts.cs create mode 100644 CSharpTranslator/tests/Tester/Enums/PacketTester.cs create mode 100644 CSharpTranslator/tests/Tester/MiscSyntax/MiscSyntax.cs diff --git a/CSharpTranslator/tests/Tester/Enums/Consts.cs b/CSharpTranslator/tests/Tester/Enums/Consts.cs new file mode 100644 index 0000000..60a9d35 --- /dev/null +++ b/CSharpTranslator/tests/Tester/Enums/Consts.cs @@ -0,0 +1,15 @@ +using System; +namespace Tester +{ + public class Consts + { + public Consts () + { + } + + public static const int Enuma = 2; + public static const int Enumb = 44; + + } +} + diff --git a/CSharpTranslator/tests/Tester/Enums/PacketTester.cs b/CSharpTranslator/tests/Tester/Enums/PacketTester.cs new file mode 100644 index 0000000..7a76361 --- /dev/null +++ b/CSharpTranslator/tests/Tester/Enums/PacketTester.cs @@ -0,0 +1,396 @@ +using System; +namespace Tester.Enums +{ + public enum PacketType + { + /// A generic value, not an actual packet type + Default, + DefaultPlus, + TestMessage = 65537, + UseCircuitCode = 65539, + UseCircuitCodePlus, + TelehubInfo = 65546, + EconomyDataRequest = 65560, + EconomyData = 65561, + AvatarPickerRequest = 65562, + AvatarPickerReply = 65564, + PlacesQuery = 65565, + PlacesReply = 65566, + DirFindQuery = 65567, + DirPlacesQuery = 65569, + DirPlacesReply = 65571, + DirPeopleReply = 65572, + DirEventsReply = 65573, + DirGroupsReply = 65574, + DirClassifiedQuery = 65575, + DirClassifiedReply = 65577, + AvatarClassifiedReply = 65578, + ClassifiedInfoRequest = 65579, + ClassifiedInfoReply = 65580, + ClassifiedInfoUpdate = 65581, + ClassifiedDelete = 65582, + ClassifiedGodDelete = 65583, + DirLandQuery = 65584, + DirLandReply = 65586, + DirPopularQuery = 65587, + DirPopularReply = 65589, + ParcelInfoRequest = 65590, + ParcelInfoReply = 65591, + ParcelObjectOwnersRequest = 65592, + ParcelObjectOwnersReply = 65593, + GroupNoticesListRequest = 65594, + GroupNoticesListReply = 65595, + GroupNoticeRequest = 65596, + TeleportRequest = 65598, + TeleportLocationRequest = 65599, + TeleportLocal = 65600, + TeleportLandmarkRequest = 65601, + TeleportProgress = 65602, + TeleportFinish = 65605, + StartLure = 65606, + TeleportLureRequest = 65607, + TeleportCancel = 65608, + TeleportStart = 65609, + TeleportFailed = 65610, + Undo = 65611, + Redo = 65612, + UndoLand = 65613, + AgentPause = 65614, + AgentResume = 65615, + ChatFromViewer = 65616, + AgentThrottle = 65617, + AgentFOV = 65618, + AgentHeightWidth = 65619, + AgentSetAppearance = 65620, + AgentQuitCopy = 65621, + ImageNotInDatabase = 65622, + RebakeAvatarTextures = 65623, + SetAlwaysRun = 65624, + ObjectDelete = 65625, + ObjectDuplicate = 65626, + ObjectDuplicateOnRay = 65627, + ObjectScale = 65628, + ObjectRotation = 65629, + ObjectFlagUpdate = 65630, + ObjectClickAction = 65631, + ObjectImage = 65632, + ObjectMaterial = 65633, + ObjectShape = 65634, + ObjectExtraParams = 65635, + ObjectOwner = 65636, + ObjectGroup = 65637, + ObjectBuy = 65638, + BuyObjectInventory = 65639, + DerezContainer = 65640, + ObjectPermissions = 65641, + ObjectSaleInfo = 65642, + ObjectName = 65643, + ObjectDescription = 65644, + ObjectCategory = 65645, + ObjectSelect = 65646, + ObjectDeselect = 65647, + ObjectAttach = 65648, + ObjectDetach = 65649, + ObjectDrop = 65650, + ObjectLink = 65651, + ObjectDelink = 65652, + ObjectGrab = 65653, + ObjectGrabUpdate = 65654, + ObjectDeGrab = 65655, + ObjectSpinStart = 65656, + ObjectSpinUpdate = 65657, + ObjectSpinStop = 65658, + ObjectExportSelected = 65659, + ModifyLand = 65660, + VelocityInterpolateOn = 65661, + VelocityInterpolateOff = 65662, + StateSave = 65663, + ReportAutosaveCrash = 65664, + SimWideDeletes = 65665, + TrackAgent = 65666, + ViewerStats = 65667, + ScriptAnswerYes = 65668, + UserReport = 65669, + AlertMessage = 65670, + AgentAlertMessage = 65671, + MeanCollisionAlert = 65672, + ViewerFrozenMessage = 65673, + HealthMessage = 65674, + ChatFromSimulator = 65675, + SimStats = 65676, + RequestRegionInfo = 65677, + RegionInfo = 65678, + GodUpdateRegionInfo = 65679, + RegionHandshake = 65684, + RegionHandshakeReply = 65685, + SimulatorViewerTimeMessage = 65686, + EnableSimulator = 65687, + DisableSimulator = 65688, + TransferRequest = 65689, + TransferInfo = 65690, + TransferAbort = 65691, + RequestXfer = 65692, + AbortXfer = 65693, + AvatarAppearance = 65694, + SetFollowCamProperties = 65695, + ClearFollowCamProperties = 65696, + RequestPayPrice = 65697, + PayPriceReply = 65698, + KickUser = 65699, + GodKickUser = 65701, + EjectUser = 65703, + FreezeUser = 65704, + AvatarPropertiesRequest = 65705, + AvatarPropertiesReply = 65707, + AvatarInterestsReply = 65708, + AvatarGroupsReply = 65709, + AvatarPropertiesUpdate = 65710, + AvatarInterestsUpdate = 65711, + AvatarNotesReply = 65712, + AvatarNotesUpdate = 65713, + AvatarPicksReply = 65714, + EventInfoRequest = 65715, + EventInfoReply = 65716, + EventNotificationAddRequest = 65717, + EventNotificationRemoveRequest = 65718, + EventGodDelete = 65719, + PickInfoReply = 65720, + PickInfoUpdate = 65721, + PickDelete = 65722, + PickGodDelete = 65723, + ScriptQuestion = 65724, + ScriptControlChange = 65725, + ScriptDialog = 65726, + ScriptDialogReply = 65727, + ForceScriptControlRelease = 65728, + RevokePermissions = 65729, + LoadURL = 65730, + ScriptTeleportRequest = 65731, + ParcelOverlay = 65732, + ParcelPropertiesRequestByID = 65733, + ParcelPropertiesUpdate = 65734, + ParcelReturnObjects = 65735, + ParcelSetOtherCleanTime = 65736, + ParcelDisableObjects = 65737, + ParcelSelectObjects = 65738, + EstateCovenantRequest = 65739, + EstateCovenantReply = 65740, + ForceObjectSelect = 65741, + ParcelBuyPass = 65742, + ParcelDeedToGroup = 65743, + ParcelReclaim = 65744, + ParcelClaim = 65745, + ParcelJoin = 65746, + ParcelDivide = 65747, + ParcelRelease = 65748, + ParcelBuy = 65749, + ParcelGodForceOwner = 65750, + ParcelAccessListRequest = 65751, + ParcelAccessListReply = 65752, + ParcelAccessListUpdate = 65753, + ParcelDwellRequest = 65754, + ParcelDwellReply = 65755, + ParcelGodMarkAsContent = 65763, + ViewerStartAuction = 65764, + UUIDNameRequest = 65771, + UUIDNameReply = 65772, + UUIDGroupNameRequest = 65773, + UUIDGroupNameReply = 65774, + ChildAgentDying = 65776, + ChildAgentUnknown = 65777, + GetScriptRunning = 65779, + ScriptRunningReply = 65780, + SetScriptRunning = 65781, + ScriptReset = 65782, + ScriptSensorRequest = 65783, + ScriptSensorReply = 65784, + CompleteAgentMovement = 65785, + AgentMovementComplete = 65786, + LogoutRequest = 65788, + LogoutReply = 65789, + ImprovedInstantMessage = 65790, + RetrieveInstantMessages = 65791, + FindAgent = 65792, + RequestGodlikePowers = 65793, + GrantGodlikePowers = 65794, + GodlikeMessage = 65795, + EstateOwnerMessage = 65796, + GenericMessage = 65797, + MuteListRequest = 65798, + UpdateMuteListEntry = 65799, + RemoveMuteListEntry = 65800, + CopyInventoryFromNotecard = 65801, + UpdateInventoryItem = 65802, + UpdateCreateInventoryItem = 65803, + MoveInventoryItem = 65804, + CopyInventoryItem = 65805, + RemoveInventoryItem = 65806, + ChangeInventoryItemFlags = 65807, + SaveAssetIntoInventory = 65808, + CreateInventoryFolder = 65809, + UpdateInventoryFolder = 65810, + MoveInventoryFolder = 65811, + RemoveInventoryFolder = 65812, + FetchInventoryDescendents = 65813, + InventoryDescendents = 65814, + FetchInventory = 65815, + FetchInventoryReply = 65816, + BulkUpdateInventory = 65817, + RemoveInventoryObjects = 65820, + PurgeInventoryDescendents = 65821, + UpdateTaskInventory = 65822, + RemoveTaskInventory = 65823, + MoveTaskInventory = 65824, + RequestTaskInventory = 65825, + ReplyTaskInventory = 65826, + DeRezObject = 65827, + DeRezAck = 65828, + RezObject = 65829, + RezObjectFromNotecard = 65830, + AcceptFriendship = 65833, + DeclineFriendship = 65834, + TerminateFriendship = 65836, + OfferCallingCard = 65837, + AcceptCallingCard = 65838, + DeclineCallingCard = 65839, + RezScript = 65840, + CreateInventoryItem = 65841, + CreateLandmarkForEvent = 65842, + RegionHandleRequest = 65845, + RegionIDAndHandleReply = 65846, + MoneyTransferRequest = 65847, + MoneyBalanceRequest = 65849, + MoneyBalanceReply = 65850, + RoutedMoneyBalanceReply = 65851, + ActivateGestures = 65852, + DeactivateGestures = 65853, + MuteListUpdate = 65854, + UseCachedMuteList = 65855, + GrantUserRights = 65856, + ChangeUserRights = 65857, + OnlineNotification = 65858, + OfflineNotification = 65859, + SetStartLocationRequest = 65860, + AssetUploadRequest = 65869, + AssetUploadComplete = 65870, + CreateGroupRequest = 65875, + CreateGroupReply = 65876, + UpdateGroupInfo = 65877, + GroupRoleChanges = 65878, + JoinGroupRequest = 65879, + JoinGroupReply = 65880, + EjectGroupMemberRequest = 65881, + EjectGroupMemberReply = 65882, + LeaveGroupRequest = 65883, + LeaveGroupReply = 65884, + InviteGroupRequest = 65885, + GroupProfileRequest = 65887, + GroupProfileReply = 65888, + GroupAccountSummaryRequest = 65889, + GroupAccountSummaryReply = 65890, + GroupAccountDetailsRequest = 65891, + GroupAccountDetailsReply = 65892, + GroupAccountTransactionsRequest = 65893, + GroupAccountTransactionsReply = 65894, + GroupActiveProposalsRequest = 65895, + GroupActiveProposalItemReply = 65896, + GroupVoteHistoryRequest = 65897, + GroupVoteHistoryItemReply = 65898, + StartGroupProposal = 65899, + GroupProposalBallot = 65900, + GroupMembersRequest = 65902, + GroupMembersReply = 65903, + ActivateGroup = 65904, + SetGroupContribution = 65905, + SetGroupAcceptNotices = 65906, + GroupRoleDataRequest = 65907, + GroupRoleDataReply = 65908, + GroupRoleMembersRequest = 65909, + GroupRoleMembersReply = 65910, + GroupTitlesRequest = 65911, + GroupTitlesReply = 65912, + GroupTitleUpdate = 65913, + GroupRoleUpdate = 65914, + LiveHelpGroupRequest = 65915, + LiveHelpGroupReply = 65916, + AgentWearablesRequest = 65917, + AgentWearablesUpdate = 65918, + AgentIsNowWearing = 65919, + AgentCachedTexture = 65920, + AgentCachedTextureResponse = 65921, + AgentDataUpdateRequest = 65922, + AgentDataUpdate = 65923, + GroupDataUpdate = 65924, + AgentGroupDataUpdate = 65925, + AgentDropGroup = 65926, + RezSingleAttachmentFromInv = 65931, + RezMultipleAttachmentsFromInv = 65932, + DetachAttachmentIntoInv = 65933, + CreateNewOutfitAttachments = 65934, + UserInfoRequest = 65935, + UserInfoReply = 65936, + UpdateUserInfo = 65937, + InitiateDownload = 65939, + MapLayerRequest = 65941, + MapLayerReply = 65942, + MapBlockRequest = 65943, + MapNameRequest = 65944, + MapBlockReply = 65945, + MapItemRequest = 65946, + MapItemReply = 65947, + SendPostcard = 65948, + ParcelMediaCommandMessage = 65955, + ParcelMediaUpdate = 65956, + LandStatRequest = 65957, + LandStatReply = 65958, + Error = 65959, + ObjectIncludeInSearch = 65960, + RezRestoreToWorld = 65961, + LinkInventoryItem = 65962, + PacketAck = 131067, + OpenCircuit = 131068, + CloseCircuit = 131069, + ObjectAdd = 131073, + MultipleObjectUpdate = 131074, + RequestMultipleObjects = 131075, + ObjectPosition = 131076, + RequestObjectPropertiesFamily = 131077, + CoarseLocationUpdate = 131078, + CrossedRegion = 131079, + ConfirmEnableSimulator = 131080, + ObjectProperties = 131081, + ObjectPropertiesFamily = 131082, + ParcelPropertiesRequest = 131083, + AttachedSound = 131085, + AttachedSoundGainChange = 131086, + PreloadSound = 131087, + ViewerEffect = 131089, + StartPingCheck = 196609, + CompletePingCheck = 196610, + AgentUpdate = 196612, + AgentAnimation = 196613, + AgentRequestSit = 196614, + AgentSit = 196615, + RequestImage = 196616, + ImageData = 196617, + ImagePacket = 196618, + LayerData = 196619, + ObjectUpdate = 196620, + ObjectUpdateCompressed = 196621, + ObjectUpdateCached = 196622, + ImprovedTerseObjectUpdate = 196623, + KillObject = 196624, + TransferPacket = 196625, + SendXferPacket = 196626, + ConfirmXferPacket = 196627, + AvatarAnimation = 196628, + AvatarSitResponse = 196629, + CameraConstraint = 196630, + ParcelProperties = 196631, + ChildAgentUpdate = 196633, + ChildAgentAlive = 196634, + ChildAgentPositionUpdate = 196635, + SoundTrigger = 196637, + } +} + diff --git a/CSharpTranslator/tests/Tester/MiscSyntax/MiscSyntax.cs b/CSharpTranslator/tests/Tester/MiscSyntax/MiscSyntax.cs new file mode 100644 index 0000000..d094d63 --- /dev/null +++ b/CSharpTranslator/tests/Tester/MiscSyntax/MiscSyntax.cs @@ -0,0 +1,34 @@ +namespace Tester.MiscSyntax +{ + + // An abstract property + + /// + /// A block of data in a packet. Packets are composed of one or more blocks, + /// each block containing one or more fields + /// + public abstract class PacketBlock + { + /// Current length of the data in this packet + public abstract int Length { get; } + + /// + /// Create a block from a byte array + /// + /// Byte array containing the serialized block + /// Starting position of the block in the byte array. + /// This will point to the data after the end of the block when the + /// call returns + public abstract void FromBytes(byte[] bytes, ref int i); + + /// + /// Serialize this block into a byte array + /// + /// Byte array to serialize this block into + /// Starting position in the byte array to serialize to. + /// This will point to the position directly after the end of the + /// serialized block when the call returns + public abstract void ToBytes(byte[] bytes, ref int i); + } + +} \ No newline at end of file diff --git a/CSharpTranslator/tests/Tester/Tester.csproj b/CSharpTranslator/tests/Tester/Tester.csproj index ef039d2..9aa8478 100644 --- a/CSharpTranslator/tests/Tester/Tester.csproj +++ b/CSharpTranslator/tests/Tester/Tester.csproj @@ -52,6 +52,11 @@ + + + + + \ No newline at end of file