about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-31 20:08:55 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-31 20:08:55 +0100
commit042297b27b64aa1ff3a7da12f5b07268ba2f11eb (patch)
treecf4948a9e951ce9f4c0268c6e891537a2b6c262a
parenta5cb80b86cdedb8cd1f3a02de47f204bd174f649 (diff)
downloaddwm-042297b27b64aa1ff3a7da12f5b07268ba2f11eb.tar.gz
applied Sander's drop_bh patch 3.3
-rw-r--r--view.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/view.c b/view.c
index de3328e..29b6b63 100644
--- a/view.c
+++ b/view.c
@@ -98,11 +98,11 @@ dotile(void) {
 			else {  /* tile window */
 				c->x += mw;
 				c->w = tw - 2 * BORDERPX;
-				if(th - 2 * BORDERPX > bh) {
+				if(th > 2 * BORDERPX) {
 					c->y += (i - nmaster) * th;
 					c->h = th - 2 * BORDERPX;
 				}
-				else /* fallback if th - 2 * BORDERPX < bh */
+				else /* fallback if th <= 2 * BORDERPX */
 					c->h = wah - 2 * BORDERPX;
 			}
 			resize(c, False);
@@ -150,7 +150,7 @@ focusprev(Arg *arg) {
 void
 incnmaster(Arg *arg) {
 	if((arrange == dofloat) || (nmaster + arg->i < 1)
-		|| (wah / (nmaster + arg->i) - 2 * BORDERPX < bh))
+		|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
 		return;
 	nmaster += arg->i;
 	if(sel)
@@ -174,8 +174,8 @@ resizemaster(Arg *arg) {
 	if(arg->i == 0)
 		master = MASTER;
 	else {
-		if(waw * (master + arg->i) / 1000 > waw - bh - 2 * BORDERPX
-			|| waw * (master + arg->i) / 1000 < bh + 2 * BORDERPX)
+		if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
+			|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
 			return;
 		master += arg->i;
 	}
ghlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/bin/bash

# Test Runner for rawk
# Usage: ./run_tests.sh

set -e  # Exit on any error

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Test counters
TOTAL_TESTS=0
PASSED_TESTS=0
FAILED_TESTS=0
SKIPPED_TESTS=0

echo -e "${BLUE}๐Ÿงช rawk Test Suite Runner${NC}"
echo "=========================="
echo ""

# Function to run a test and capture results
run_test() {
    local test_file="$1"
    local category="$2"
    local test_name=$(basename "$test_file" .rawk)
    
    echo -e "${BLUE}Testing ${category}: ${test_name}${NC}"
    echo "----------------------------------------"
    
    # Check if test file exists
    if [ ! -f "$test_file" ]; then
        echo -e "${YELLOW}SKIP: Test file not found${NC}"
        ((SKIPPED_TESTS++))
        echo ""
        return 0
    fi
    
    # Run the test
    if output=$(awk -f ../rawk.awk "$test_file" 2>&1 | awk -f - 2>&1); then
        echo "$output"
        
        # Count test results
        local pass_count=$(echo "$output" | grep -c "โœ“" || true)
        local fail_count=$(echo "$output" | grep -c "โŒ" || true)
        local warn_count=$(echo "$output" | grep -c "โš ๏ธ" || true)
        
        if [ "$fail_count" -gt 0 ]; then
            echo -e "${RED}FAIL: ${fail_count} test(s) failed${NC}"
            ((FAILED_TESTS++))
        elif [ "$pass_count" -gt 0 ]; then
            echo -e "${GREEN}PASS: ${pass_count} test(s) passed${NC}"
            ((PASSED_TESTS++))
        else
            echo -e "${YELLOW}UNKNOWN: No clear test results${NC}"
            ((PASSED_TESTS++))  # Assume success if no clear failure
        fi
    else
        echo -e "${RED}ERROR: Test execution failed${NC}"
        echo "Error output:"
        awk -f ../rawk.awk "$test_file" 2>&1 | awk -f - 2>&1 | head -5 | sed 's/^/  /'
        ((FAILED_TESTS++))
    fi
    
    ((TOTAL_TESTS++))
    echo ""
}

# Function to run tests in a directory
run_test_category() {
    local category="$1"
    local test_files="$2"
    
    echo -e "${BLUE}๐Ÿ“‹ ${category}${NC}"
    echo "========================="
    
    for test_file in $test_files; do
        run_test "$test_file" "$category"
    done
}

# Core language feature tests
run_test_category "Core Language Features" "
    core/test_basic.rawk
    core/test_basic_functions.rawk
    core/test_multiline.rawk
    core/test_recursive.rawk
    core/test_suite.rawk
    core/test_array_fix.rawk
    core/test_edge_cases.rawk
    core/test_failure.rawk
"

# Standard library tests
run_test_category "Standard Library" "
    stdlib/test_predicates.rawk
    stdlib/test_predicates_simple.rawk
    stdlib/test_stdlib_simple.rawk
    stdlib/test_functional.rawk
    stdlib/test_enhanced_utilities_simple.rawk
    stdlib/test_phase2_utilities.rawk
"

# Real world example tests
run_test_category "Real World Examples" "
    real_world/test_csv_processor.rawk
    real_world/test_data_processing.rawk
    real_world/test_log_parser.rawk
    real_world/test_mixed.rawk
    real_world/test_system_monitor.rawk
"

# Summary
echo -e "${BLUE}๐Ÿ“Š Test Summary${NC}"
echo "==============="
echo "Total Tests Run: $TOTAL_TESTS"
echo -e "Passed: ${GREEN}$PASSED_TESTS${NC}"
echo -e "Failed: ${RED}$FAILED_TESTS${NC}"
echo -e "Skipped: ${YELLOW}$SKIPPED_TESTS${NC}"

if [ "$FAILED_TESTS" -eq 0 ]; then
    echo ""
    echo -e "${GREEN}๐ŸŽ‰ All tests passed! rawk is working correctly.${NC}"
    exit 0
else
    echo ""
    echo -e "${RED}โŒ Some tests failed. Please check the output above.${NC}"
    exit 1
fi