Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looks like an issue in FilipinoProvider #7

Open
wouterst79 opened this issue Jul 29, 2020 · 1 comment
Open

Looks like an issue in FilipinoProvider #7

wouterst79 opened this issue Jul 29, 2020 · 1 comment

Comments

@wouterst79
Copy link

if (imod10 != 4 && imod10 != 6 || imod10 != 9)
return PluralType.ONE;

this if statement always evaluates to true.. should it be

if (imod10 != 4 && imod10 != 6 && imod10 != 9)
return PluralType.ONE;

@wouterst79
Copy link
Author

BTW, here's my test code


    public interface IPluralProvider
    {
        float[] GetSampleValues();
        PluralType GetPluralType(float n);
    }


        public static void Test()
        {

            var interfacetype = typeof(IPluralProvider);
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (interfacetype.IsAssignableFrom(type) && !type.IsInterface)
                {
                    var instance = (IPluralProvider)Activator.CreateInstance(type);

                    var values = instance.GetSampleValues();

                    var found = new HashSet<PluralType>();
                    foreach (var value in values)
                    {
                        var ptype = instance.GetPluralType(value);
                        if (!found.Add(ptype))
                        {
                            Console.WriteLine($"{type.Name} Duplicate type {ptype}: {value}");
                            foreach (var v2 in values)
                                if (instance.GetPluralType(v2) == ptype)
                                    Console.WriteLine($"\t({v2})");
                        }

                    }

                    for (float i = 0; i < 200; i++)
                    {

                        var ptype = instance.GetPluralType(i);
                        if (found.Add(ptype)) Console.WriteLine($"{type.Name} Missing sample type {ptype}: {i}");

                        ptype = instance.GetPluralType(i + .1f);
                        if (found.Add(ptype)) Console.WriteLine($"{type.Name} Missing sample type {ptype}: {i + .1f}");

                        ptype = instance.GetPluralType(i + .12f);
                        if (found.Add(ptype)) Console.WriteLine($"{type.Name} Missing sample type {ptype}: {i + .12f}");

                        ptype = instance.GetPluralType(i + .1243f);
                        if (found.Add(ptype)) Console.WriteLine($"{type.Name} Missing sample type {ptype}: {i + .1243f}");

                    }

                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant