t_uniq.sh revision 1.1
11.1Sabhinav# $NetBSD: t_uniq.sh,v 1.1 2016/10/22 14:13:39 abhinav Exp $ 21.1Sabhinav# 31.1Sabhinav# Copyright (c) 2016 The NetBSD Foundation, Inc. 41.1Sabhinav# All rights reserved. 51.1Sabhinav# 61.1Sabhinav# This code is derived from software contributed to The NetBSD Foundation 71.1Sabhinav# by Abhinav Upadhyay 81.1Sabhinav# 91.1Sabhinav# Redistribution and use in source and binary forms, with or without 101.1Sabhinav# modification, are permitted provided that the following conditions 111.1Sabhinav# are met: 121.1Sabhinav# 1. Redistributions of source code must retain the above copyright 131.1Sabhinav# notice, this list of conditions and the following disclaimer. 141.1Sabhinav# 2. Redistributions in binary form must reproduce the above copyright 151.1Sabhinav# notice, this list of conditions and the following disclaimer in the 161.1Sabhinav# documentation and/or other materials provided with the distribution. 171.1Sabhinav# 181.1Sabhinav# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 191.1Sabhinav# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 201.1Sabhinav# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 211.1Sabhinav# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 221.1Sabhinav# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 231.1Sabhinav# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 241.1Sabhinav# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 251.1Sabhinav# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 261.1Sabhinav# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 271.1Sabhinav# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 281.1Sabhinav# POSSIBILITY OF SUCH DAMAGE. 291.1Sabhinav# 301.1Sabhinav 311.1Sabhinavatf_test_case basic 321.1Sabhinavbasic_head() 331.1Sabhinav{ 341.1Sabhinav atf_set "descr" "Checks the basic functionality" 351.1Sabhinav} 361.1Sabhinavbasic_body() 371.1Sabhinav{ 381.1Sabhinav atf_check -o file:$(atf_get_srcdir)/d_basic.out uniq \ 391.1Sabhinav $(atf_get_srcdir)/d_basic.in 401.1Sabhinav} 411.1Sabhinav 421.1Sabhinavatf_test_case test_counts 431.1Sabhinavtest_counts_head() 441.1Sabhinav{ 451.1Sabhinav atf_set "descr" "Tests the -c option, comparing each line of the input" \ 461.1Sabhinav "file data starting from the second field" 471.1Sabhinav} 481.1Sabhinavtest_counts_body() 491.1Sabhinav{ 501.1Sabhinav atf_check -o file:$(atf_get_srcdir)/d_counts.out uniq -c -f 1 \ 511.1Sabhinav $(atf_get_srcdir)/d_input.in 521.1Sabhinav} 531.1Sabhinav 541.1Sabhinavatf_test_case show_duplicates 551.1Sabhinavshow_duplicates_head() 561.1Sabhinav{ 571.1Sabhinav atf_set "descr" "Checks the -d option, comparing each line of the input" \ 581.1Sabhinav "file data starting from the second field" 591.1Sabhinav} 601.1Sabhinavshow_duplicates_body() 611.1Sabhinav{ 621.1Sabhinav atf_check -o file:$(atf_get_srcdir)/d_show_duplicates.out uniq -d -f 1 \ 631.1Sabhinav $(atf_get_srcdir)/d_input.in 641.1Sabhinav} 651.1Sabhinav 661.1Sabhinavatf_test_case show_uniques 671.1Sabhinavshow_uniques_head() 681.1Sabhinav{ 691.1Sabhinav atf_set "descr" "Checks the -u option, comparing each line of the input" \ 701.1Sabhinav "file data starting from the second field" 711.1Sabhinav} 721.1Sabhinavshow_uniques_body() 731.1Sabhinav{ 741.1Sabhinav atf_check -o file:$(atf_get_srcdir)/d_show_uniques.out uniq -u -f 1 \ 751.1Sabhinav $(atf_get_srcdir)/d_input.in 761.1Sabhinav} 771.1Sabhinav 781.1Sabhinavatf_test_case show_duplicates_from_third_character 791.1Sabhinavshow_duplicates_from_third_character_head() 801.1Sabhinav{ 811.1Sabhinav atf_set "descr" "Checks the -d option, comparing each line of the input" \ 821.1Sabhinav "file data starting from the third character (-s option)" 831.1Sabhinav} 841.1Sabhinavshow_duplicates_from_third_character_body() 851.1Sabhinav{ 861.1Sabhinav atf_check -o empty uniq -d -s 2 $(atf_get_srcdir)/d_input.in 871.1Sabhinav 881.1Sabhinav} 891.1Sabhinav 901.1Sabhinavatf_init_test_cases() 911.1Sabhinav{ 921.1Sabhinav atf_add_test_case basic 931.1Sabhinav atf_add_test_case test_counts 941.1Sabhinav atf_add_test_case show_duplicates 951.1Sabhinav atf_add_test_case show_uniques 961.1Sabhinav atf_add_test_case show_duplicates_from_third_character 971.1Sabhinav} 98