📄 metadata_object.c
字号:
} if(!mutils__compare_block(vorbiscomment, block)) return false; if(block->data.vorbis_comment.num_comments != 4) { printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } printf("OK\n"); printf("testing FLAC__metadata_object_clone()... "); blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; } if(!mutils__compare_block(block, blockcopy)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_delete()... "); FLAC__metadata_object_delete(blockcopy); printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on middle of array..."); vc_delete_(vorbiscomment, 2); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on end of array..."); vc_delete_(vorbiscomment, 2); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on beginning of array..."); vc_delete_(vorbiscomment, 0); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 0)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 1, "rem0=val0"); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 2, "rem0=val1"); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 3, "rem0=val2"); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_remove_entry_matching(\"blah\")..."); if((j = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, "blah")) != 0) { printf("FAILED, expected 0, got %d\n", j); return false; } if(block->data.vorbis_comment.num_comments != 4) { printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_remove_entry_matching(\"rem0\")..."); vc_delete_(vorbiscomment, 1); if((j = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, "rem0")) != 1) { printf("FAILED, expected 1, got %d\n", j); return false; } if(block->data.vorbis_comment.num_comments != 3) { printf("FAILED, expected 3 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_remove_entries_matching(\"blah\")..."); if((j = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, "blah")) != 0) { printf("FAILED, expected 0, got %d\n", j); return false; } if(block->data.vorbis_comment.num_comments != 3) { printf("FAILED, expected 3 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_remove_entries_matching(\"rem0\")..."); vc_delete_(vorbiscomment, 1); vc_delete_(vorbiscomment, 1); if((j = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, "rem0")) != 2) { printf("FAILED, expected 2, got %d\n", j); return false; } if(block->data.vorbis_comment.num_comments != 1) { printf("FAILED, expected 1 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_set_comment(copy)..."); vc_set_new_(&entry, vorbiscomment, 0, "name5=field5"); FLAC__metadata_object_vorbiscomment_set_comment(block, 0, entry, /*copy=*/true); if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_set_vendor_string(copy)..."); vc_set_vs_new_(&entry, vorbiscomment, "name6=field6"); FLAC__metadata_object_vorbiscomment_set_vendor_string(block, entry, /*copy=*/true); if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_delete()... "); FLAC__metadata_object_delete(vorbiscomment); FLAC__metadata_object_delete(block); printf("OK\n"); printf("testing FLAC__metadata_object_new()... "); block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); if(0 == block) { printf("FAILED, returned NULL\n"); return false; } printf("OK\n"); printf("testing FLAC__metadata_object_clone()... "); vorbiscomment = FLAC__metadata_object_clone(block); if(0 == vorbiscomment) { printf("FAILED, returned NULL\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_append_comment(own) on empty array..."); vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_append_comment(own) on non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 1, "name2=field2"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_delete()... "); FLAC__metadata_object_delete(vorbiscomment); FLAC__metadata_object_delete(block); printf("OK\n"); printf("testing FLAC__metadata_object_new()... "); block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); if(0 == block) { printf("FAILED, returned NULL\n"); return false; } printf("OK\n"); printf("testing FLAC__metadata_object_clone()... "); vorbiscomment = FLAC__metadata_object_clone(block); if(0 == vorbiscomment) { printf("FAILED, returned NULL\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on empty array..."); vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on beginning of non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 0, "name2=field2"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on middle of non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 1, "name3=field3"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 1, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 3, "name4=field4"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 3, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 4, "name3=field3dup1"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 4, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); vc_insert_new_(&entry, vorbiscomment, 5, "name3=field3dup1"); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 5, entry, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(first, own)..."); vc_replace_new_(&entry, vorbiscomment, "name3=field3new1", /*all=*/false); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/false, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; if(block->data.vorbis_comment.num_comments != 6) { printf("FAILED, expected 6 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(all, own)..."); vc_replace_new_(&entry, vorbiscomment, "name3=field3new2", /*all=*/true); entry_clone_(&entry); if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/true, /*copy=*/false)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; if(block->data.vorbis_comment.num_comments != 4) { printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); return false; } printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on middle of array..."); vc_delete_(vorbiscomment, 2); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on end of array..."); vc_delete_(vorbiscomment, 2); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on beginning of array..."); vc_delete_(vorbiscomment, 0); if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 0)) { printf("FAILED, returned false\n"); return false; } if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_set_comment(own)..."); vc_set_new_(&entry, vorbiscomment, 0, "name5=field5"); entry_clone_(&entry); FLAC__metadata_object_vorbiscomment_set_comment(block, 0, entry, /*copy=*/false); if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_vorbiscomment_set_vendor_string(own)..."); vc_set_vs_new_(&entry, vorbiscomment, "name6=field6"); entry_clone_(&entry); FLAC__metadata_object_vorbiscomment_set_vendor_string(block, entry, /*copy=*/false); if(!mutils__compare_block(vorbiscomment, block)) return false; printf("OK\n"); printf("testing FLAC__metadata_object_delete()... "); FLAC__metadata_object_delete(vorbiscomment); FLAC__metadata_object_delete(block); printf("OK\n"); printf("testing CUESHEET\n"); { FLAC__StreamMetadata_CueSheet_Track *track_, *trackcopy_; printf("testing FLAC__metadata_object_cuesheet_track_new()... "); track_ = FLAC__metadata_object_cuesheet_track_new(); if(0 == track_) { printf("FAILED, returned NULL\n"); return false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -