void test_listRemove_given_11_12_should_remove_11_and_remain_1_size(void) { listAdd(list , 11); listAdd(list , 12); UnityAssertEqualNumber((_U_SINT)((11)), (_U_SINT)((listRemove(list))), (((void *)0)), (_U_UINT)61, UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((list->size)), (((void *)0)), (_U_UINT)62, UNITY_DISPLAY_STYLE_INT); ListDel(list); }
void test_listAdd_given_4_2_should_add_4_2(void) { listAdd(list , 4); listAdd(list , 2); UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((list->buffer[0])), (((void *)0)), (_U_UINT)29, UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((list->buffer[1])), (((void *)0)), (_U_UINT)30, UNITY_DISPLAY_STYLE_INT); ListDel(list); }
void test_listRemove_given_13_14_should_Remove_13_14_and_throw_exception(void) { unsigned int err; { jmp_buf *PrevFrame, NewFrame; unsigned int MY_ID = (0); PrevFrame = CExceptionFrames[(0)].pFrame; CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); if (_setjmp(NewFrame) == 0) { if (&PrevFrame) { listAdd(list , 13); listAdd(list , 14); UnityAssertEqualNumber((_U_SINT)((13)), (_U_SINT)((listRemove(list))), (((void *)0)), (_U_UINT)75, UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((_U_SINT)((14)), (_U_SINT)((listRemove(list))), (((void *)0)), (_U_UINT)76, UNITY_DISPLAY_STYLE_INT); UnityFail( ("Should throw ERROR_LIST_EMPTY exception"), (_U_UINT)77);; } else { } CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); } else { err = CExceptionFrames[MY_ID].Exception; err=err; } CExceptionFrames[MY_ID].pFrame = PrevFrame; } if (CExceptionFrames[(0)].Exception != (0x5A5A5A5A)) { UnityAssertEqualNumber((_U_SINT)((ERROR_LIST_EMPTY)), (_U_SINT)((err)), ("Expect ERROR_LIST_EMPTY exception"), (_U_UINT)81, UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((list->size)), (((void *)0)), (_U_UINT)82, UNITY_DISPLAY_STYLE_INT); } ListDel(list); }
// 说明:从就绪列表中删除 void TaskDelReady(TASK *task) { ListDel(&list_ready_tasks, &task->list_ready); }
// 说明:从挂起列表中删除 void TaskDelSuspud(TASK *task) { ListDel(&list_suspud_tasks, &task->list_suspud); }
BOOL ZipDlg::OnListNotify( HWND hDlg, WPARAM wParam, LPARAM lParam) { NMHDR* nmhdr = (NMHDR*)lParam ; // キーダウン if( nmhdr->code == LVN_KEYDOWN) { // デリート if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE) { ListDel( ) ; EnableWindow( hwndOk, ( ListView_GetItemCount( hwndList) != 0 ? TRUE : FALSE)) ; } // Ctrl + A else if( GetKeyState( VK_CONTROL) < 0 && ( (LPNMLVKEYDOWN)lParam)->wVKey == 'A') { ListView_SetItemState( hwndList, -1, LVIS_SELECTED, LVIS_SELECTED) ; } // Alt + ↑↓ else if( GetKeyState( VK_MENU) < 0) { if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_UP) { ListMove( TRUE) ; } else if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_DOWN) { ListMove( FALSE) ; } } return TRUE ; } // 選択変更時 else if( nmhdr->code == LVN_ITEMCHANGED) { EnableWindow( hwndOk, ( ListView_GetItemCount( hwndList) != 0 ? TRUE : FALSE)) ; EnableWindow( hwndDel, ( ListView_GetSelectedCount( hwndList) != 0 ? TRUE : FALSE)) ; return TRUE ; } // ヘッダ部分クリック else if( nmhdr->code == LVN_COLUMNCLICK) { ListView_SortItems( hwndList, ListSortProc, ( (NMLISTVIEW*)lParam)->iSubItem) ; ListReload() ; return TRUE ; } // 右クリック else if( nmhdr->code == NM_RCLICK) { POINT pt ; GetCursorPos( &pt) ; HMENU hMenu = LoadMenu( hInstance, MAKEINTRESOURCE(IDR_POPMENU)) ; HMENU hMenuPopup = GetSubMenu( hMenu, 0) ; if( ListView_GetSelectedCount( hwndList) == 0) { EnableMenuItem( hMenuPopup, IDM_DEL, MF_BYCOMMAND | MF_GRAYED) ; EnableMenuItem( hMenuPopup, IDM_SETFOLDER, MF_BYCOMMAND | MF_GRAYED) ; EnableMenuItem( hMenuPopup, IDM_UP, MF_BYCOMMAND | MF_GRAYED) ; EnableMenuItem( hMenuPopup, IDM_DOWN, MF_BYCOMMAND | MF_GRAYED) ; } if( ListView_GetItemCount( hwndList) == 0) { EnableMenuItem( hMenuPopup, IDM_SORTFILE, MF_BYCOMMAND | MF_GRAYED) ; EnableMenuItem( hMenuPopup, IDM_SORTPATH, MF_BYCOMMAND | MF_GRAYED) ; EnableMenuItem( hMenuPopup, IDM_SORTZIP, MF_BYCOMMAND | MF_GRAYED) ; } DWORD dwID = TrackPopupMenu( hMenuPopup, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL) ; switch( dwID) { case IDM_ADD: ListAddFileDlg() ; break ; case IDM_DEL: ListDel() ; break ; case IDM_UP: case IDM_DOWN: ListMove( dwID == IDM_UP) ; break ; case IDM_SORTPATH: ListView_SortItems( hwndList, ListSortProc, 1) ; ListReload() ; break ; case IDM_SORTFILE: ListView_SortItems( hwndList, ListSortProc, 2) ; ListReload() ; break ; case IDM_SORTZIP: ListView_SortItems( hwndList, ListSortProc, 0) ; ListReload() ; break ; case IDM_SETFOLDER: ListSetFolder() ; break ; } DestroyMenu( hMenu) ; } return FALSE ; }
BOOL ZipDlg::OnDelBtn( HWND hDlg, WPARAM wParam, LPARAM lParam) { ListDel() ; return TRUE ; }